-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from lanwen/fix_JENKINS-32132
[FIXES JENKINS-32132] Check status message is null (in case of wrong …
- Loading branch information
Showing
2 changed files
with
10 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
import static com.cloudbees.jenkins.Messages.GitHubCommitNotifier_DisplayName; | ||
import static com.cloudbees.jenkins.Messages.GitHubCommitNotifier_SettingCommitStatus; | ||
import static com.coravy.hudson.plugins.github.GithubProjectProperty.displayNameFor; | ||
import static com.google.common.base.Objects.firstNonNull; | ||
import static hudson.model.Result.FAILURE; | ||
import static hudson.model.Result.SUCCESS; | ||
import static hudson.model.Result.UNSTABLE; | ||
|
@@ -41,8 +42,9 @@ | |
* @author <a href="mailto:[email protected]">Nicolas De Loof</a> | ||
*/ | ||
public class GitHubCommitNotifier extends Notifier { | ||
private static final ExpandableMessage DEFAULT_MESSAGE = new ExpandableMessage(""); | ||
|
||
private ExpandableMessage statusMessage = new ExpandableMessage(""); | ||
private ExpandableMessage statusMessage = DEFAULT_MESSAGE; | ||
|
||
private final String resultOnFailure; | ||
private static final Result[] SUPPORTED_RESULTS = {FAILURE, UNSTABLE, SUCCESS}; | ||
|
@@ -124,7 +126,8 @@ private void updateCommitStatus(@Nonnull AbstractBuild<?, ?> build, | |
final String sha1 = ObjectId.toString(BuildDataHelper.getCommitSHA1(build)); | ||
|
||
StatusResult status = statusFrom(build); | ||
String message = defaultIfEmpty(statusMessage.expandAll(build, listener), status.getMsg()); | ||
String message = defaultIfEmpty(firstNonNull(statusMessage, DEFAULT_MESSAGE) | ||
.expandAll(build, listener), status.getMsg()); | ||
String contextName = displayNameFor(build.getProject()); | ||
|
||
for (GitHubRepositoryName name : GitHubRepositoryNameContributor.parseAssociatedNames(build.getProject())) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters