Skip to content

Commit 45e2ea6

Browse files
authored
Revert "Disable automatic test file validation (#730)" (#733)
1 parent 5b34858 commit 45e2ea6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/main/java/hudson/tasks/junit/JUnitResultArchiver.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import hudson.model.AbstractProject;
3636
import hudson.model.BuildListener;
3737
import hudson.model.Descriptor;
38+
import hudson.model.Item;
3839
import hudson.model.Result;
3940
import hudson.model.Run;
4041
import hudson.model.Saveable;
@@ -58,6 +59,7 @@
5859
import jenkins.tasks.SimpleBuildStep;
5960
import org.apache.tools.ant.DirectoryScanner;
6061
import org.apache.tools.ant.types.FileSet;
62+
import org.kohsuke.stapler.AncestorInPath;
6163
import org.kohsuke.stapler.DataBoundConstructor;
6264
import org.kohsuke.stapler.DataBoundSetter;
6365
import org.kohsuke.stapler.QueryParameter;
@@ -544,6 +546,22 @@ public String getDisplayName() {
544546
return Messages.JUnitResultArchiver_DisplayName();
545547
}
546548

549+
/**
550+
* Performs on-the-fly validation on the file mask wildcard.
551+
* @param project Project.
552+
* @param value File mask to validate.
553+
*
554+
* @return the validation result.
555+
* @throws IOException if an error occurs.
556+
*/
557+
public FormValidation doCheckTestResults(@AncestorInPath AbstractProject project, @QueryParameter String value)
558+
throws IOException {
559+
if (project == null || !project.hasPermission(Item.WORKSPACE)) {
560+
return FormValidation.ok();
561+
}
562+
return FilePath.validateFileMask(project.getSomeWorkspace(), value);
563+
}
564+
547565
@Override
548566
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
549567
return true;

0 commit comments

Comments
 (0)