Skip to content

Commit

Permalink
add checkForNull for resolveOne in GHRepoName
Browse files Browse the repository at this point in the history
  • Loading branch information
MerkushevKirill authored and Kirill Merkushev committed Jul 29, 2015
1 parent 33087eb commit 9723aab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/cloudbees/jenkins/GitHubRepositoryName.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GitHub;

import javax.annotation.CheckForNull;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -118,9 +119,8 @@ protected GHRepository adapt(GitHub item) {
*
* This is useful if the caller only relies on the read access to the repository and doesn't need to
* walk possible candidates.
*
* Result can be null
*/
@CheckForNull
public GHRepository resolveOne() {
for (GHRepository r : resolve())
return r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@

/**
* This abstract class calls {@link #applyNullSafe(Object)} only after success validation of inner object for null
*
* {@inheritDoc}
*
* @author lanwen (Merkushev Kirill)
*/
public abstract class NullSafeFunction<F, T> implements Function<F, T> {
/**
* {@inheritDoc}
*/

@Override
public T apply(@Nullable F input) {
return applyNullSafe(Preconditions.checkNotNull(input, "This function not allows to use null as argument"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
/**
* This abstract class calls {@link #applyNullSafe(Object)} only after success validation of inner object for null
*
* {@inheritDoc}
*
* @author lanwen (Merkushev Kirill)
*/

public abstract class NullSafePredicate<T> implements Predicate<T> {

/**
* {@inheritDoc}
*/
@Override
public boolean apply(T input) {
return applyNullSafe(checkNotNull(input, "Argument for this predicate can't be null"));
Expand Down

0 comments on commit 9723aab

Please sign in to comment.