diff --git a/src/main/java/net/masterthought/jenkins/CucumberReportDescriptor.java b/src/main/java/net/masterthought/jenkins/CucumberReportDescriptor.java index 396aefb..71a2e5c 100644 --- a/src/main/java/net/masterthought/jenkins/CucumberReportDescriptor.java +++ b/src/main/java/net/masterthought/jenkins/CucumberReportDescriptor.java @@ -35,6 +35,10 @@ public FormValidation doCheckTrendsLimit(@QueryParameter String value) { return isValidInteger(value); } + public FormValidation doMaxStringLengthConstraint(@QueryParameter String value) { + return isValidInteger(value); + } + public FormValidation doCheckFailedStepsNumber(@QueryParameter String value) { return isValidInteger(value); } diff --git a/src/main/java/net/masterthought/jenkins/CucumberReportPublisher.java b/src/main/java/net/masterthought/jenkins/CucumberReportPublisher.java index f603d5e..77bd807 100644 --- a/src/main/java/net/masterthought/jenkins/CucumberReportPublisher.java +++ b/src/main/java/net/masterthought/jenkins/CucumberReportPublisher.java @@ -12,6 +12,7 @@ import java.util.Set; import java.util.UUID; +import com.fasterxml.jackson.core.StreamReadConstraints; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.AbortException; import hudson.Extension; @@ -78,6 +79,7 @@ public class CucumberReportPublisher extends Recorder implements SimpleBuildStep private boolean undefinedAsNotFailingStatus; private int trendsLimit; + private int maxStringLengthConstraint; private String sortingMethod; private List classifications; private String customJsFiles; @@ -158,6 +160,14 @@ public void setTrendsLimit(int trendsLimit) { this.trendsLimit = trendsLimit; } + public int getMaxStringLengthConstraint() { + return maxStringLengthConstraint; + } + + public void setMaxStringLengthConstraint(int maxStringLengthConstraint) { + this.maxStringLengthConstraint = maxStringLengthConstraint; + } + public String getFileExcludePattern() { return fileExcludePattern; } @@ -559,6 +569,8 @@ private void generateReport(Run build, FilePath workspace, TaskListener li setFailingStatuses(configuration); + StreamReadConstraints.overrideDefaultStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(maxStringLengthConstraint).build()); + ReportBuilder reportBuilder = new ReportBuilder(jsonFilesToProcess, configuration); Reportable result = reportBuilder.generateReports(); diff --git a/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.jelly b/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.jelly index 364342d..2b77761 100644 --- a/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.jelly +++ b/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.jelly @@ -33,6 +33,11 @@ field="trendsLimit"> + + + diff --git a/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.properties b/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.properties index 43157da..d9f9dff 100644 --- a/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.properties +++ b/src/main/resources/net/masterthought/jenkins/CucumberReportPublisher/config.properties @@ -6,6 +6,7 @@ fileIncludePattern.title=File Include Pattern classificationsFilePattern.title=Classifications File Pattern fileExcludePattern.title=File Exclude Pattern trendsLimit.title=Limit for trends +maxStringLengthConstraint.title=Maximum string size (Stream read constraint of JacksonCore) # === buildResult=Build Result buildResult.description=This section allows to configure when the build is marked as failed or unstable. Result is changed when any of below rule is enabled.