/** * Create the redirector to use, if any. * * @return a configured RedirectorElement. */ private RedirectorElement createRedirector() { RedirectorElement result = new RedirectorElement(); if (storepass != null) { StringBuilder input = new StringBuilder(storepass).append('\n'); if (keypass != null) { input.append(keypass).append('\n'); } result.setInputString(input.toString()); result.setLogInputString(false); // Try to avoid showing password prompts on log output, as they would be confusing. LineContainsRegExp filter = new LineContainsRegExp(); RegularExpression rx = new RegularExpression(); // TODO only handles English locale, not ja or zh_CN rx.setPattern("^(Enter Passphrase for keystore: |Enter key password for .+: )$"); filter.addConfiguredRegexp(rx); filter.setNegate(true); result.createErrorFilterChain().addLineContainsRegExp(filter); } return result; }
/** * Add a <CODE>RedirectorElement</CODE> to this task. * @param redirectorElement <CODE>RedirectorElement</CODE>. */ public void addConfiguredRedirector(RedirectorElement redirectorElement) { if (this.redirectorElement != null) { throw new BuildException("Cannot have > 1 nested <redirector>s"); } else { this.redirectorElement = redirectorElement; } }
/** * Add a <CODE>RedirectorElement</CODE> to this task. * * @param redirectorElement * <CODE>RedirectorElement</CODE>. */ public void addConfiguredRedirector(RedirectorElement redirectorElement) { if (this.redirectorElement != null) { throw new BuildException("Cannot have > 1 nested <redirector>s"); } else { this.redirectorElement = redirectorElement; } }
/** * verify our jar files * @throws BuildException on error. */ @Override public void execute() throws BuildException { //validation logic final boolean hasJar = jar != null; if (!hasJar && !hasResources()) { throw new BuildException(ERROR_NO_SOURCE); } beginExecution(); //patch the redirector to save output to a file RedirectorElement redirector = getRedirector(); redirector.setAlwaysLog(true); FilterChain outputFilterChain = redirector.createOutputFilterChain(); outputFilterChain.add(outputCache); try { Path sources = createUnifiedSourcePath(); for (Resource r : sources) { FileProvider fr = r.as(FileProvider.class); verifyOneJar(fr.getFile()); } } finally { endExecution(); } }
/** * Add a <code>RedirectorElement</code> to this task. * * @param redirectorElement <code>RedirectorElement</code>. * @since Ant 1.6.2 */ public void addConfiguredRedirector(RedirectorElement redirectorElement) { if (this.redirectorElement != null) { throw new BuildException("cannot have > 1 nested <redirector>s"); } this.redirectorElement = redirectorElement; incompatibleWithSpawn = true; }
/** * Add a <code>RedirectorElement</code> to this task. * @param redirectorElement <code>RedirectorElement</code>. */ public void addConfiguredRedirector(RedirectorElement redirectorElement) { if (this.redirectorElement != null) { throw new BuildException("cannot have > 1 nested redirectors"); } this.redirectorElement = redirectorElement; incompatibleWithSpawn = true; }
/** * get the redirector. Non-null between invocations of * {@link #beginExecution()} and {@link #endExecution()} * @return a redirector or null */ public RedirectorElement getRedirector() { return redirector; }
/** * Always throw an {@link java.lang.UnsupportedOperationException} exception. * * @param redirectorElement the element */ @Override public void addConfiguredRedirector(RedirectorElement redirectorElement) { throw new UnsupportedOperationException("Redirector element is not supported"); }