Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[JENKINS-34759] [JENKINS-34760] Use validateAnt* method rather than v…
Browse files Browse the repository at this point in the history
…alidateFile*.
  • Loading branch information
uhafner committed May 18, 2016
1 parent 0055ce3 commit fa460e3
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/main/java/hudson/plugins/analysis/core/PluginDescriptor.java
Expand Up @@ -188,7 +188,7 @@ public FormValidation doCheckDefaultEncoding(@QueryParameter final String defaul
}

/**
* Performs on-the-fly validation on the file name pattern.
* Performs on-the-fly validation on the ant pattern for input files.
*
* @param project
* the project
Expand All @@ -200,13 +200,23 @@ public FormValidation doCheckDefaultEncoding(@QueryParameter final String defaul
*/
public FormValidation doCheckPattern(@AncestorInPath final AbstractProject<?, ?> project,
@QueryParameter final String pattern) throws IOException {
if (project != null) {
return FilePath.validateFileMask(project.getSomeWorkspace(), pattern);
}
else {
// Workflow jobs have no workspace
return FormValidation.ok();
if (project != null) { // Workflow jobs have no workspace
try {
FilePath workspace = project.getSomeWorkspace();
if (workspace != null) {
String result = workspace.validateAntFileMask(pattern,
FilePath.VALIDATE_ANT_FILE_MASK_BOUND);
if (result != null) {
return FormValidation.error(result);
}
}
}
catch (InterruptedException e) {
// ignore and return ok
}
}

return FormValidation.ok();
}

/**
Expand Down

0 comments on commit fa460e3

Please sign in to comment.