Skip to content

Commit

Permalink
[FIXED JENKINS-16444] NPE showEvenIfUnstableOption when first adding …
Browse files Browse the repository at this point in the history
…trigger section.

At this time the target project is unset so it has no known type and we just have to assume the threshold is valid.
  • Loading branch information
jglick committed Jan 22, 2013
1 parent 810a395 commit 0bdde83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -62,6 +62,9 @@
Improving responsiveness of <b>People</b> page.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16342">issue 16342</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16397">issue 16397</a>)
<li class=bug>
Exception printed to log while adding <b>Build other projects</b> post-build step.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16444">issue 16444</a>)
<li class=bug>
Improved logging and error output from SSHD in Jenkins.
<li class=rfe>
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/hudson/tasks/BuildTrigger.java
Expand Up @@ -65,6 +65,7 @@
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;

/**
* Triggers builds of other projects.
Expand Down Expand Up @@ -310,9 +311,9 @@ public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}

public boolean showEvenIfUnstableOption(Class<? extends AbstractProject> jobType) {
public boolean showEvenIfUnstableOption(@CheckForNull Class<? extends AbstractProject<?,?>> jobType) {
// UGLY: for promotion process, this option doesn't make sense.
return !jobType.getName().contains("PromotionProcess");
return jobType == null || !jobType.getName().contains("PromotionProcess");
}

/**
Expand Down
Expand Up @@ -30,7 +30,7 @@ THE SOFTWARE.
autoCompleteDelimChar=","
field="childProjects"/>
</f:entry>
<j:if test="${descriptor.showEvenIfUnstableOption(targetType)}">
<j:if test="${descriptor.showEvenIfUnstableOption(targetType)}"> <!-- XXX JENKINS-16444 this will always be true when first adding step -->
<f:entry title="">
<f:radio name="threshold" checked="${instance.threshold==null || instance.threshold.toString()=='SUCCESS'}"
title="${%Trigger only if build succeeds}" value="SUCCESS"/>
Expand Down

0 comments on commit 0bdde83

Please sign in to comment.