Skip to content

Commit

Permalink
[JENKINS-38974] fill in commentTextParameterMode if it's missing
Browse files Browse the repository at this point in the history
Any existing jobs which were configured before this option was added (or
jobs uploaded as raw XML produced by Jenkins Job Builder, for example)
will not have <commentTextParameterMode/>. Ensure it is filled in with
the default value to avoid a NullPointerException later in the comment
event handling.
  • Loading branch information
danc86 committed Nov 25, 2016
1 parent 8eafa2c commit 814b85b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Expand Up @@ -1851,6 +1851,9 @@ public Object readResolve() throws ObjectStreamException {
if (changeSubjectParameterMode == null) {
changeSubjectParameterMode = GerritTriggerParameters.ParameterMode.PLAIN;
}
if (commentTextParameterMode == null) {
commentTextParameterMode = GerritTriggerParameters.ParameterMode.PLAIN;
}
return super.readResolve();
}
/*
Expand Down
Expand Up @@ -106,6 +106,8 @@ private void verifyAllOff(GerritTrigger trigger) {
//Setting introduced after the version under test, so it should have the default value
assertSame("Change subject mode == PLAIN", GerritTriggerParameters.ParameterMode.PLAIN,
trigger.getChangeSubjectParameterMode());
assertSame("Comment text mode == PLAIN", GerritTriggerParameters.ParameterMode.PLAIN,
trigger.getCommentTextParameterMode());
assertEquals(GerritServer.ANY_SERVER, trigger.getServerName());

assertThat(trigger.getGerritProjects(), hasItem(
Expand Down

0 comments on commit 814b85b

Please sign in to comment.