Example usage for javax.xml.transform TransformerException getStackTrace

List of usage examples for javax.xml.transform TransformerException getStackTrace

Introduction

In this page you can find the example usage for javax.xml.transform TransformerException getStackTrace.

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

Provides programmatic access to the stack trace information printed by #printStackTrace() .

Usage

From source file:org.forgerock.doc.maven.ImageDataTransformer.java

/**
 * Update files that match, adding them to the results.
 *
 * @param file/*www  .  j  a va  2 s.  c  o m*/
 *            File to update
 * @param depth
 *            Not used
 * @param results
 *            List of files updated
 * @throws IOException
 *             Something went wrong changing a file's content.
 */
@Override
protected final void handleFile(final File file, final int depth, final Collection<File> results)
        throws IOException {
    if (file.isFile()) {
        try {
            Source xml = new StreamSource(file);
            File tmpFile = File.createTempFile(file.getName(), ".tmp");
            transformer.transform(xml, new StreamResult(tmpFile));

            FileUtils.deleteQuietly(file);
            FileUtils.moveFile(tmpFile, file);
            results.add(file);
        } catch (TransformerException te) {
            throw new IOException("Failed to transform " + file.getPath() + ": " + te.getStackTrace());
        }
    }
}