/** * Throws an exception with the given nested exception if * failOnError is true, otherwise logs the message using the WARN * level. * * @param ex Throwable * @since Ant 1.8.0 */ protected void handleError(final Throwable ex) { if (failOnError) { throw new BuildException(ex); } log("Caught an exception: " + ex, Project.MSG_WARN); }
/** * Throws an exception with the given nested exception if * failOnError and failOnTransformationError are true, otherwise * logs the message using the WARN level. * * @param ex Exception * @since Ant 1.8.0 */ protected void handleTransformationError(final Exception ex) { if (failOnError && failOnTransformationError) { throw new BuildException(ex); } log("Caught an error during transformation: " + ex, Project.MSG_WARN); }
/** * Throws an exception with the given message if failOnError is * true, otherwise logs the message using the WARN level. * * @param msg String * @since Ant 1.8.0 */ protected void handleError(final String msg) { if (failOnError) { throw new BuildException(msg, getLocation()); } log(msg, Project.MSG_WARN); }
try { final long styleSheetLastModified = stylesheet.getLastModified(); log("In file " + inFile + " time: " + inFile.lastModified(), Project.MSG_DEBUG); log("Out file " + outFile + " time: " + outFile.lastModified(), Project.MSG_DEBUG); log("Style file " + xslFile + " time: " + styleSheetLastModified, Project.MSG_DEBUG); if (force || inFile.lastModified() >= outFile.lastModified() || styleSheetLastModified >= outFile.lastModified()) { ensureDirectoryFor(outFile); log("Processing " + inFile + " to " + outFile, Project.MSG_INFO); configureLiaison(stylesheet); setLiaisonDynamicFileParameters(liaison, inFile); liaison.transform(inFile, outFile); } else { log("Skipping input file " + inFile + " because it is older than output file " + outFile + " and so is the stylesheet " + stylesheet, Project.MSG_DEBUG); log("Failed to process " + inFile, Project.MSG_INFO); if (outFile != null) { outFile.delete();
log("Skipping " + inF + " it is a directory.", Project.MSG_VERBOSE); return; log("Skipping " + inFile + " it cannot get mapped to output.", Project.MSG_VERBOSE); return; log("Skipping " + inFile + " its mapping is ambiguous.", Project.MSG_VERBOSE); return; || styleSheetLastModified > outF.lastModified()) { ensureDirectoryFor(outF); log("Processing " + inF + " to " + outF); configureLiaison(stylesheet); setLiaisonDynamicFileParameters(liaison, inF); log("Failed to process " + inFile, Project.MSG_INFO); if (outF != null) { outF.delete();
log("Loading stylesheet " + stylesheet, Project.MSG_INFO); liaison.addParam(p.getName(), (String) evaluatedParam); } else { log("XSLTLiaison '" + liaison.getClass().getName() + "' supports only String parameters. Converting parameter '" + p.getName() + "' to its String value '" + evaluatedParam, Project.MSG_WARN); log("Failed to transform using stylesheet " + stylesheet, Project.MSG_INFO); handleTransformationError(ex);
/** * Get the Liaison implementation to use in processing. * * @return an instance of the XSLTLiaison interface. */ protected XSLTLiaison getLiaison() { // if processor wasn't specified, use TraX. if (liaison == null) { if (processor != null) { try { resolveProcessor(processor); } catch (final Exception e) { handleError(e); } } else { try { resolveProcessor(PROCESSOR_TRAX); } catch (final Throwable e1) { log(StringUtils.getStackTrace(e1), Project.MSG_ERR); handleError(e1); } } } return liaison; }
public void execute() throws BuildException { if ("style".equals(getTaskType())) { log("Warning: the task name <style> is deprecated. Use <xslt> instead.", Project.MSG_WARN); ((XSLTLoggerAware) liaison).setLogger(this); log("Using " + liaison.getClass().toString(), Project.MSG_VERBOSE); log("DEPRECATED - the 'style' attribute should be relative to the project's"); log(" basedir, not the tasks's basedir."); stylesheet = alternative; log("Transforming into " + destDir, Project.MSG_INFO);