/** * Throws a BuildException if the destination directory hasn't * been specified. * @since Ant 1.7 */ private void checkDest() { if (destDir == null) { handleError("destdir attributes must be set!"); } }
/** * Defines the mapper to map source to destination files. * @param mapper the mapper to use * @exception BuildException if more than one mapper is defined * @since Ant 1.6.2 */ public void addMapper(final Mapper mapper) { if (mapperElement != null) { handleError("Cannot define more than one mapper"); } else { mapperElement = mapper; } }
/** * Ensure the directory exists for a given file * * @param targetFile the file for which the directories are required. * @exception BuildException if the directories cannot be created. */ private void ensureDirectoryFor(final File targetFile) throws BuildException { final File directory = targetFile.getParentFile(); if (!directory.exists() && !directory.mkdirs() && !directory.isDirectory()) { handleError("Unable to create directory: " + directory.getAbsolutePath()); } }
/** * Create the factory element to configure a trax liaison. * @return the newly created factory element. * @throws BuildException if the element is created more than one time. */ public Factory createFactory() throws BuildException { if (factory != null) { handleError("'factory' element must be unique"); } else { factory = new Factory(); } return factory; }
/** * Add a nested <style> element. * @param rc the configured Resources object represented as <style>. * @since Ant 1.7 */ public void addConfiguredStyle(final Resources rc) { if (rc.size() != 1) { handleError( "The style element must be specified with exactly one nested resource."); } else { setXslResource(rc.iterator().next()); } }
/** * 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; }
handleError(baseMessage); return; handleError(baseMessage + " but not as both"); return; handleError("input file " + inFile + " does not exist"); return; handleError("stylesheet " + styleResource + " doesn't exist."); return; handleError("no resources specified");
liaison.setStylesheet(fp.getFile()); } else { handleError(liaison.getClass().toString() + " accepts the stylesheet only as a file"); return;