Skip to content

Commit

Permalink
Merge pull request #9 from imod/JENKINS-16259
Browse files Browse the repository at this point in the history
[FIXED JENKINS-16259] use @DataBoundConstructor instead of newInstance()
  • Loading branch information
gboissinot committed Dec 1, 2013
2 parents 9e5bf7d + 22cd6a3 commit af87bd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
8 changes: 7 additions & 1 deletion pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
20 changes: 4 additions & 16 deletions src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -459,20 +461,6 @@ public XUnitThreshold[] getListXUnitThresholdInstance() {
};
}

@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.