Skip to content
Permalink
Browse files

Merge pull request #9 from imod/JENKINS-16259

[FIXED JENKINS-16259] use @DataBoundConstructor instead of newInstance()
  • Loading branch information
gboissinot committed Dec 1, 2013
2 parents 9e5bf7d + 22cd6a3 commit af87bd5775648e6006e4e06698810848b030ef3e
Showing with 11 additions and 17 deletions.
  1. +7 −1 pom.xml
  2. +4 −16 src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.447</version>
<version>1.480</version>
</parent>

<artifactId>xunit</artifactId>
@@ -252,6 +252,12 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>1.100</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
@@ -29,6 +29,7 @@
import org.jenkinsci.plugins.xunit.threshold.SkippedThreshold;
import org.jenkinsci.plugins.xunit.threshold.XUnitThreshold;
import org.jenkinsci.plugins.xunit.threshold.XUnitThresholdDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import java.io.File;
@@ -60,8 +61,9 @@ public XUnitPublisher(TestType[] types, XUnitThreshold[] thresholds) {
this.thresholds = thresholds;
}

public XUnitPublisher(TestType[] types, XUnitThreshold[] thresholds, int thresholdMode) {
this.types = types;
@DataBoundConstructor
public XUnitPublisher(TestType[] tools, XUnitThreshold[] thresholds, int thresholdMode) {
this.types = tools;
this.thresholds = thresholds;
this.thresholdMode = thresholdMode;
}
@@ -459,20 +461,6 @@ public String getHelpFile() {
};
}

@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) throws FormException {
List<TestType> types = Descriptor.newInstancesFromHeteroList(
req, formData, "tools", getListXUnitTypeDescriptors());
List<XUnitThreshold> thresholds = Descriptor.newInstancesFromHeteroList(
req, formData, "thresholds", getListXUnitThresholdDescriptors());
int thresholdMode = 0;
try {
thresholdMode = formData.getInt("thresholdMode");
} catch (JSONException e) {
//ignore
}
return new XUnitPublisher(types.toArray(new TestType[types.size()]), thresholds.toArray(new XUnitThreshold[thresholds.size()]), thresholdMode);
}
}

}

0 comments on commit af87bd5

Please sign in to comment.