/** * Displays the specified error message using the <code>ErrorHandler</code>. */ public void displayError(String message) { try { SVGAbstractTranscoder.this.handler.error (new TranscoderException(message)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
private static Throwable unwrapException(TranscoderException ex) { // The TranscoderException is generally useless... return ex.getException() != null ? ex.getException() : ex; }
throw new TranscoderException(ex); throw new TranscoderException(ex); TranscoderException exception = new TranscoderException(ex.getMessage()); exception.initCause(ex); throw exception;
exception = new TranscoderException(ex);
public int getWidth(int pIndex) throws IOException { checkBounds(pIndex); try { return rasterizer.getDefaultWidth(); } catch (TranscoderException e) { throw new IIOException(e.getMessage(), e); } }
}catch(TranscoderException e){ StringWriter trace = new StringWriter(); e.printStackTrace(new PrintWriter(trace)); new String[]{svgURL.toString(), e.getClass().getName(), e.getMessage(), trace.toString() })) });
/** * Writes SVG to an output stream. * * @param svgDocument * the document to output * @param writer * the stream to write the document to */ public static void writeSVG(SVGDocument svgDocument, Writer writer) { StringWriter sw = new StringWriter(); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); Node node = svgDocument.getDocumentElement(); Source src = new DOMSource(node); Result dest = new StreamResult(sw); transformer.transform(src, dest); PrettyPrinter pp = new PrettyPrinter(); pp.print(new StringReader(sw.toString()), writer); } catch (TransformerConfigurationException e) { e.printStackTrace(new PrintWriter(writer)); } catch (TransformerException e) { e.printStackTrace(new PrintWriter(writer)); } catch (TranscoderException e) { e.printStackTrace(new PrintWriter(writer)); } catch (IOException e) { e.printStackTrace(new PrintWriter(writer)); } }
svgCache.put( cp, img ); } catch ( TranscoderException e ) { LOG.warn( "Could not rasterize svg '{}': {}", g.imageURL, e.getLocalizedMessage() ); } catch ( IOException e ) { LOG.warn( "Could not rasterize svg '{}': {}", g.imageURL, e.getLocalizedMessage() );
/** * Creates a transcoder exception. */ protected TranscoderException fatalError(String key, Object[] params) throws TranscoderException { TranscoderException result = new TranscoderException(key); errorHandler.fatalError(result); return result; } }
public int getHeight(int pIndex) throws IOException { checkBounds(pIndex); try { return rasterizer.getDefaultHeight(); } catch (TranscoderException e) { throw new IIOException(e.getMessage(), e); } }
throw new TranscoderException(ex); throw new TranscoderException(ex); TranscoderException exception = new TranscoderException(ex.getMessage()); exception.initCause(ex); throw exception;
ex.printStackTrace(); throw new IOException("Couldn't convert SVG");
/** * Creates a transcoder exception. */ protected TranscoderException fatalError(String key, Object[] params) throws TranscoderException { TranscoderException result = new TranscoderException(key); errorHandler.fatalError(result); return result; } }
/** * Displays the specified message using the <code>ErrorHandler</code>. */ public void displayMessage(String message) { try { SVGAbstractTranscoder.this.handler.warning (new TranscoderException(message)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
private synchronized void init() throws IOException { // Need the extra test, to avoid throwing an IOException from the Transcoder if (imageInput == null) { throw new IllegalStateException("input == null"); } if (reader == null) { WMFTranscoder transcoder = new WMFTranscoder(); ByteArrayOutputStream output = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(output, "UTF8"); try { TranscoderInput in = new TranscoderInput(IIOUtil.createStreamAdapter(imageInput)); TranscoderOutput out = new TranscoderOutput(writer); // TODO: Transcodinghints? transcoder.transcode(in, out); } catch (TranscoderException e) { throw new IIOException(e.getMessage(), e); } reader = new SVGImageReader(getOriginatingProvider()); reader.setInput(ImageIO.createImageInputStream(new ByteArrayInputStream(output.toByteArray()))); } }
e.printStackTrace(); } catch (TranscoderException e) { e.printStackTrace(); } catch (SVGGraphics2DIOException e) { e.printStackTrace();
/** * Receive notification of a successfully completed DOM tree generation. */ public void notify(Document doc) throws SAXException { try { TranscoderInput transInput = new TranscoderInput(doc); // Buffering is done by the pipeline (See shouldSetContentLength) TranscoderOutput transOutput = new TranscoderOutput(this.output); transcoder.transcode(transInput, transOutput); } catch (TranscoderException ex) { if (ex.getException() != null) { if (getLogger().isDebugEnabled()) { getLogger().debug("Got transcoder exception writing image, rethrowing nested exception", ex); } throw new SAXException("Exception writing image", ex.getException()); } if (getLogger().isDebugEnabled()) { getLogger().debug("Got transcoder exception writing image, rethrowing", ex); } throw new SAXException("Exception writing image", ex); } catch (Exception ex) { if (getLogger().isDebugEnabled()) { getLogger().debug("Got exception writing image, rethrowing", ex); } throw new SAXException("Exception writing image", ex); } }
/** * Displays the specified error using the {@link ErrorHandler}. * @param e the exception to display */ public void displayError(Exception e) { try { getErrorHandler().error(new TranscoderException(e)); } catch (TranscoderException ex) { throw new RuntimeException(); } }
/** * Displays the specified error using the <code>ErrorHandler</code>. */ public void displayError(Exception e) { try { e.printStackTrace(); SVGAbstractTranscoder.this.handler.error (new TranscoderException(e)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
/** * Invoked when a warning occured while transcoding. * @param ex the warning informations encapsulated in a TranscoderException * @exception TranscoderException if the method want to forward * the exception */ public void warning(TranscoderException ex) throws TranscoderException { System.err.println("WARNING: "+ex.getMessage()); } }