/** * 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); }
/** * 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); }
/** * 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)); } }
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);
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)); } }
/** * 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); }
/** * 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); }
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(); } }
/** * 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)); } }
/** * 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(); } }
/** * 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(); } }
/** * 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(); } }
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 } }
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 } }
@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()); }
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 } }
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 } }
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)); } }
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; }
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; }