Skip to content
Permalink
Browse files

Fix issues caused by JENKINS-31150 not being backward compatible.

1 - NPE thrown when tags are stored under the old format.
2 - Tags are not displayed in job configuration when reloaded under the new format.
  • Loading branch information
jringuette committed Nov 27, 2015
1 parent 20745f2 commit abf6f1dd9c6f4a7907cc47f43fb35ce8bf9ff7f1
Showing with 28 additions and 2 deletions.
  1. +28 −2 src/main/java/org/jenkinsci/plugins/rundeck/RundeckNotifier.java
@@ -26,7 +26,13 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@@ -69,8 +75,10 @@
private final String options;

private final String nodeFilters;

private transient final String tag;

private final String[] tags;
private String[] tags;

private final Boolean shouldWaitForRundeckJob;

@@ -93,6 +101,7 @@ public RundeckNotifier(String rundeckInstance, String jobId, String options, Str
this.options = options;
this.nodeFilters = nodeFilters;
this.tags = extracttags(tags,",");
this.tag = null;
this.shouldWaitForRundeckJob = shouldWaitForRundeckJob;
this.shouldFailTheBuild = shouldFailTheBuild;
this.includeRundeckLogs = includeRundeckLogs;
@@ -103,6 +112,9 @@ public Object readResolve() {
if (StringUtils.isEmpty(rundeckInstance)) {
this.rundeckInstance = "Default";
}
if (tags == null) {
this.tags = extracttags(this.tag, ",");
}
return this;
}

@@ -392,6 +404,20 @@ public String getOptions() {
public String getNodeFilters() {
return nodeFilters;
}

public String getTag() {
StringBuilder builder = new StringBuilder();

for (int i=0; i<tags.length; i++) {
builder.append(tags[i]);

if (i+1<tags.length) {
builder.append(",");
}
}

return builder.toString();
}

public String[] getTags() {
return tags;

0 comments on commit abf6f1d

Please sign in to comment.
You can’t perform that action at this time.