本文整理了Java中hudson.FilePath.validateAntFileMask()
方法的一些代码示例,展示了FilePath.validateAntFileMask()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilePath.validateAntFileMask()
方法的具体详情如下:
包路径:hudson.FilePath
类名称:FilePath
方法名:validateAntFileMask
[英]Validates the ant file mask (like "foo/bar/.txt, zot/.jar") against this directory, and try to point out the problem.
This is useful in conjunction with FormValidation.
[中]根据此目录验证ant文件掩码(如“foo/bar/.txt,zot/.jar”),并尝试指出问题所在。
这与FormValidation结合使用非常有用。
代码示例来源:origin: jenkinsci/jenkins
/**
* Same as {@link #validateAntFileMask(String, int, boolean)} with caseSensitive set to true
*/
public String validateAntFileMask(final String fileMasks, final int bound) throws IOException, InterruptedException {
return validateAntFileMask(fileMasks, bound, true);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Validates the ant file mask (like "foo/bar/*.txt, zot/*.jar")
* against this directory, and try to point out the problem.
*
* <p>
* This is useful in conjunction with {@link FormValidation}.
*
* @return
* null if no error was found. Otherwise returns a human readable error message.
* @since 1.90
* @see #validateFileMask(FilePath, String)
* @deprecated use {@link #validateAntFileMask(String, int)} instead
*/
@Deprecated
public String validateAntFileMask(final String fileMasks) throws IOException, InterruptedException {
return validateAntFileMask(fileMasks, Integer.MAX_VALUE);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Checks the GLOB-style file mask. See {@link #validateAntFileMask(String)}.
* Requires configure permission on ancestor AbstractProject object in request,
* or admin permission if no such ancestor is found.
* @since 1.294
*/
public FormValidation validateFileMask(String value, boolean errorIfNotExist, boolean caseSensitive) throws IOException {
checkPermissionForValidate();
value = fixEmpty(value);
if(value==null)
return FormValidation.ok();
try {
if(!exists()) // no workspace. can't check
return FormValidation.ok();
String msg = validateAntFileMask(value, VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive);
if(errorIfNotExist) return FormValidation.error(msg);
else return FormValidation.warning(msg);
} catch (InterruptedException e) {
return FormValidation.ok(Messages.FilePath_did_not_manage_to_validate_may_be_too_sl(value));
}
}
代码示例来源:origin: jenkinsci/jenkins
if (result == null || result.isBetterOrEqualTo(Result.UNSTABLE)) {
try {
String msg = ws.validateAntFileMask(artifacts, FilePath.VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive);
if (msg != null) {
listener.getLogger().println(msg);
代码示例来源:origin: jenkinsci/jenkins
protected void check() throws IOException, ServletException {
String value = fixEmpty(request.getParameter("value"));
AbstractProject<?,?> p = (AbstractProject<?,?>)subject;
if(value==null || p==null) {
ok(); // none entered yet, or something is seriously wrong
return;
}
try {
FilePath ws = getBaseDirectory(p);
if(ws==null || !ws.exists()) {// no workspace. can't check
ok();
return;
}
String msg = ws.validateAntFileMask(value, FilePath.VALIDATE_ANT_FILE_MASK_BOUND);
if(errorIfNotExist) error(msg);
else warning(msg);
} catch (InterruptedException e) {
ok(Messages.FormFieldValidator_did_not_manage_to_validate_may_be_too_sl(value));
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Same as {@link #validateAntFileMask(String, int, boolean)} with caseSensitive set to true
*/
public String validateAntFileMask(final String fileMasks, final int bound) throws IOException, InterruptedException {
return validateAntFileMask(fileMasks, bound, true);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Validates the ant file mask (like "foo/bar/*.txt, zot/*.jar")
* against this directory, and try to point out the problem.
*
* <p>
* This is useful in conjunction with {@link FormValidation}.
*
* @return
* null if no error was found. Otherwise returns a human readable error message.
* @since 1.90
* @see #validateFileMask(FilePath, String)
* @deprecated use {@link #validateAntFileMask(String, int)} instead
*/
@Deprecated
public String validateAntFileMask(final String fileMasks) throws IOException, InterruptedException {
return validateAntFileMask(fileMasks, Integer.MAX_VALUE);
}
代码示例来源:origin: jenkinsci/warnings-ng-plugin
private FormValidation validatePatternInWorkspace(final @QueryParameter String pattern,
final FilePath workspace) throws IOException, InterruptedException {
String result = workspace.validateAntFileMask(pattern, FilePath.VALIDATE_ANT_FILE_MASK_BOUND);
if (result != null) {
return FormValidation.error(result);
}
return FormValidation.ok();
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Checks the GLOB-style file mask. See {@link #validateAntFileMask(String)}.
* Requires configure permission on ancestor AbstractProject object in request,
* or admin permission if no such ancestor is found.
* @since 1.294
*/
public FormValidation validateFileMask(String value, boolean errorIfNotExist, boolean caseSensitive) throws IOException {
checkPermissionForValidate();
value = fixEmpty(value);
if(value==null)
return FormValidation.ok();
try {
if(!exists()) // no workspace. can't check
return FormValidation.ok();
String msg = validateAntFileMask(value, VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive);
if(errorIfNotExist) return FormValidation.error(msg);
else return FormValidation.warning(msg);
} catch (InterruptedException e) {
return FormValidation.ok(Messages.FilePath_did_not_manage_to_validate_may_be_too_sl(value));
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Checks the GLOB-style file mask. See {@link #validateAntFileMask(String)}.
* Requires configure permission on ancestor AbstractProject object in request.
* @since 1.294
*/
public FormValidation validateFileMask(String value, boolean errorIfNotExist) throws IOException {
AbstractProject subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
subject.checkPermission(Item.CONFIGURE);
value = fixEmpty(value);
if(value==null)
return FormValidation.ok();
try {
if(!exists()) // no workspace. can't check
return FormValidation.ok();
String msg = validateAntFileMask(value);
if(errorIfNotExist) return FormValidation.error(msg);
else return FormValidation.warning(msg);
} catch (InterruptedException e) {
return FormValidation.ok();
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Checks the GLOB-style file mask. See {@link #validateAntFileMask(String)}.
* Requires configure permission on ancestor AbstractProject object in request.
* @since 1.294
*/
public FormValidation validateFileMask(String value, boolean errorIfNotExist) throws IOException {
AbstractProject subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
subject.checkPermission(Item.CONFIGURE);
value = fixEmpty(value);
if(value==null)
return FormValidation.ok();
try {
if(!exists()) // no workspace. can't check
return FormValidation.ok();
String msg = validateAntFileMask(value);
if(errorIfNotExist) return FormValidation.error(msg);
else return FormValidation.warning(msg);
} catch (InterruptedException e) {
return FormValidation.ok();
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Checks the GLOB-style file mask. See {@link #validateAntFileMask(String)}.
* Requires configure permission on ancestor AbstractProject object in request.
* @since 1.294
*/
public FormValidation validateFileMask(String value, boolean errorIfNotExist) throws IOException {
AbstractProject subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
subject.checkPermission(Item.CONFIGURE);
value = fixEmpty(value);
if(value==null)
return FormValidation.ok();
try {
if(!exists()) // no workspace. can't check
return FormValidation.ok();
String msg = validateAntFileMask(value);
if(errorIfNotExist) return FormValidation.error(msg);
else return FormValidation.warning(msg);
} catch (InterruptedException e) {
return FormValidation.ok();
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
protected void check() throws IOException, ServletException {
String value = fixEmpty(request.getParameter("value"));
AbstractProject<?,?> p = (AbstractProject<?,?>)subject;
if(value==null || p==null) {
ok(); // none entered yet, or something is seriously wrong
return;
}
try {
FilePath ws = getBaseDirectory(p);
if(ws==null || !ws.exists()) {// no workspace. can't check
ok();
return;
}
String msg = ws.validateAntFileMask(value);
if(errorIfNotExist) error(msg);
else warning(msg);
} catch (InterruptedException e) {
ok(); // coundn't check
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
protected void check() throws IOException, ServletException {
String value = fixEmpty(request.getParameter("value"));
AbstractProject<?,?> p = (AbstractProject<?,?>)subject;
if(value==null || p==null) {
ok(); // none entered yet, or something is seriously wrong
return;
}
try {
FilePath ws = getBaseDirectory(p);
if(ws==null || !ws.exists()) {// no workspace. can't check
ok();
return;
}
String msg = ws.validateAntFileMask(value);
if(errorIfNotExist) error(msg);
else warning(msg);
} catch (InterruptedException e) {
ok(); // coundn't check
}
}
代码示例来源:origin: org.jenkins-ci.plugins/javadoc
@Override public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException {
listener.getLogger().println(Messages.JavadocArchiver_Publishing());
EnvVars env = build.getEnvironment(listener);
FilePath javadoc = workspace.child(env.expand(javadocDir));
FilePath target = new FilePath(keepAll ? getJavadocDir(build) : getJavadocDir(build.getParent()));
try {
if (javadoc.copyRecursiveTo("**/*",target)==0) {
if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) {
// If the build failed, don't complain that there was no javadoc.
// The build probably didn't even get to the point where it produces javadoc.
listener.error(Messages.JavadocArchiver_NoMatchFound(javadoc,javadoc.validateAntFileMask("**/*")));
}
build.setResult(Result.FAILURE);
return;
}
} catch (IOException e) {
Util.displayIOException(e,listener);
e.printStackTrace(listener.fatalError(Messages.JavadocArchiver_UnableToCopy(javadoc,target)));
build.setResult(Result.FAILURE);
return;
}
build.addAction(new JavadocBuildAction());
}
代码示例来源:origin: hudson/hudson-2.x
protected void check() throws IOException, ServletException {
String value = fixEmpty(request.getParameter("value"));
AbstractProject<?,?> p = (AbstractProject<?,?>)subject;
if(value==null || p==null) {
ok(); // none entered yet, or something is seriously wrong
return;
}
try {
FilePath ws = getBaseDirectory(p);
if(ws==null || !ws.exists()) {// no workspace. can't check
ok();
return;
}
String msg = ws.validateAntFileMask(value);
if(errorIfNotExist) error(msg);
else warning(msg);
} catch (InterruptedException e) {
ok(); // coundn't check
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
protected void check() throws IOException, ServletException {
String value = fixEmpty(request.getParameter("value"));
AbstractProject<?, ?> p = (AbstractProject<?, ?>) subject;
if (value == null || p == null) {
ok(); // none entered yet, or something is seriously wrong
return;
}
try {
FilePath ws = getBaseDirectory(p);
if (ws == null || !ws.exists()) { // no workspace. can't check
ok();
return;
}
String msg = ws.validateAntFileMask(value);
if (errorIfNotExist) {
error(msg);
} else {
warning(msg);
}
} catch (InterruptedException e) {
ok(); // coundn't check
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
protected void check() throws IOException, ServletException {
String value = fixEmpty(request.getParameter("value"));
AbstractProject<?,?> p = (AbstractProject<?,?>)subject;
if(value==null || p==null) {
ok(); // none entered yet, or something is seriously wrong
return;
}
try {
FilePath ws = getBaseDirectory(p);
if(ws==null || !ws.exists()) {// no workspace. can't check
ok();
return;
}
String msg = ws.validateAntFileMask(value, FilePath.VALIDATE_ANT_FILE_MASK_BOUND);
if(errorIfNotExist) error(msg);
else warning(msg);
} catch (InterruptedException e) {
ok(Messages.FormFieldValidator_did_not_manage_to_validate_may_be_too_sl(value));
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
listener.getLogger().println(Messages.JavadocArchiver_Publishing());
EnvVars env = build.getEnvironment(listener);
FilePath javadoc = build.getWorkspace().child(env.expand(javadocDir));
FilePath target = new FilePath(keepAll ? getJavadocDir(build) : getJavadocDir(build.getProject()));
try {
if (javadoc.copyRecursiveTo("**/*",target)==0) {
if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) {
// If the build failed, don't complain that there was no javadoc.
// The build probably didn't even get to the point where it produces javadoc.
listener.error(Messages.JavadocArchiver_NoMatchFound(javadoc,javadoc.validateAntFileMask("**/*")));
}
build.setResult(Result.FAILURE);
return true;
}
} catch (IOException e) {
Util.displayIOException(e,listener);
e.printStackTrace(listener.fatalError(Messages.JavadocArchiver_UnableToCopy(javadoc,target)));
build.setResult(Result.FAILURE);
return true;
}
// add build action, if javadoc is recorded for each build
if(keepAll)
build.addAction(new JavadocBuildAction(build));
return true;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
listener.getLogger().println(Messages.JavadocArchiver_Publishing());
EnvVars env = build.getEnvironment(listener);
FilePath javadoc = build.getWorkspace().child(env.expand(javadocDir));
FilePath target = new FilePath(keepAll ? getJavadocDir(build) : getJavadocDir(build.getProject()));
try {
if (javadoc.copyRecursiveTo("**/*",target)==0) {
if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) {
// If the build failed, don't complain that there was no javadoc.
// The build probably didn't even get to the point where it produces javadoc.
listener.error(Messages.JavadocArchiver_NoMatchFound(javadoc,javadoc.validateAntFileMask("**/*")));
}
build.setResult(Result.FAILURE);
return true;
}
} catch (IOException e) {
Util.displayIOException(e,listener);
e.printStackTrace(listener.fatalError(Messages.JavadocArchiver_UnableToCopy(javadoc,target)));
build.setResult(Result.FAILURE);
return true;
}
// add build action, if javadoc is recorded for each build
if(keepAll)
build.addAction(new JavadocBuildAction(build));
return true;
}
内容来源于网络,如有侵权,请联系作者删除!