cause = ((TransformerException)cause).getCause(); else if(cause instanceof SAXException) cause = ((SAXException)cause).getException();
cause = ((TransformerException)cause).getCause(); else if(cause instanceof SAXException) cause = ((SAXException)cause).getException();
cause = ((TransformerException)cause).getCause(); else if(cause instanceof WrappedRuntimeException) cause = ((WrappedRuntimeException)cause).getException();
cause = ((TransformerException)cause).getCause(); else if(cause instanceof WrappedRuntimeException) cause = ((WrappedRuntimeException)cause).getException();
cause = ((TransformerException)cause).getCause(); else if(cause instanceof WrappedRuntimeException) cause = ((WrappedRuntimeException)cause).getException();
public void fatalError(TransformerException ex) throws TransformerException { if (this.warningEx != null && ex.getCause() == null) { ex = this.warningEx; } this.warningEx = null; this.exception = ex; throw ex; }
public void fatalError(TransformerException ex) throws TransformerException { if (warningEx != null && ex.getCause() == null) { ex = warningEx; } warningEx = null; exception = ex; throw ex; } }
public void fatalError(TransformerException ex) throws TransformerException { if (warningEx != null && ex.getCause() == null) { ex = warningEx; } warningEx = null; exception = ex; throw ex; } }
public void error(TransformerException ex) throws TransformerException { // If we had a warning previoulsy, and the current exception has no cause, then use the warning. // This is how Xalan behaves on <xsl:message terminate="yes">: it first issues a warning with all // the useful information, then a useless "stylesheed directed termination" error. if (warningEx != null && ex.getCause() == null) { ex = warningEx; } warningEx = null; // Keep the exception for later use. exception = ex; // and rethrow it throw ex; }
public void error(TransformerException ex) throws TransformerException { // If we had a warning previoulsy, and the current exception has no cause, then use the warning. // This is how Xalan behaves on <xsl:message terminate="yes">: it first issues a warning with all // the useful information, then a useless "stylesheed directed termination" error. if (warningEx != null && ex.getCause() == null) { ex = warningEx; } warningEx = null; // Keep the exception for later use. exception = ex; // and rethrow it throw ex; }
@Override public void fatalError(TransformerException exception) throws TransformerException { while (exception != exception.getCause() && exception.getCause() != null && exception.getCause() instanceof TransformerException) { exception = (TransformerException) exception.getCause(); } errors.add(exception); }
/** * {@inheritDoc} * * @see javax.xml.transform.ErrorListener#error(javax.xml.transform.TransformerException) */ public void error(TransformerException ex) throws TransformerException { // If we had a warning previoulsy, and the current exception has no cause, then use the warning. // This is how Xalan behaves on <xsl:message terminate="yes">: it first issues a warning with all // the useful information, then a useless "stylesheed directed termination" error. if (this.warningEx != null && ex.getCause() == null) { ex = this.warningEx; } this.warningEx = null; // Keep the exception for later use. this.exception = ex; // and rethrow it throw ex; }
public void write( ContentHandler handler) throws IOException { try { TransformerFactory.newInstance().newTransformer().transform( new DOMSource( context.peek().getOwnerDocument()), new SAXResult( handler)); modified = false; } catch ( TransformerConfigurationException e) { assert false; throw new RuntimeException( "no transformer", e); } catch ( TransformerException e) { Throwable t = e.getCause(); if ( t instanceof IOException) throw ( IOException) t; assert false; throw new RuntimeException( "transformer failed", e); } }
public void write( ContentHandler handler) throws IOException { try { TransformerFactory.newInstance().newTransformer().transform( new DOMSource( context.peek().getOwnerDocument()), new SAXResult( handler)); modified = false; } catch ( TransformerConfigurationException e) { assert false; throw new RuntimeException( "no transformer", e); } catch ( TransformerException e) { Throwable t = e.getCause(); if ( t instanceof IOException) throw ( IOException) t; assert false; throw new RuntimeException( "transformer failed", e); } }
public static void write( Document doc, OutputStream out) throws IOException { try { doc.normalize(); Source source = new DOMSource( doc); Result result = new StreamResult( out); Transformer xslt = TransformerFactory.newInstance().newTransformer(); xslt.setOutputProperty( OutputKeys.ENCODING, "iso-8859-1"); xslt.setOutputProperty( OutputKeys.INDENT, "yes"); xslt.transform( source, result); } catch ( TransformerConfigurationException e) { assert false; throw new RuntimeException( "no transformer", e); } catch ( TransformerException e) { Throwable t = e.getCause(); if ( t instanceof IOException) throw ( IOException) t; assert false; throw new RuntimeException( "transformer failed", e); } }
private static Document stripWhiteSpaceUsingXSLT(Document forDoc) { try { Transform whitespaceStripper = getStripWhitespaceTransform(forDoc); return whitespaceStripper.getResultDocument(); } catch (TransformerException e) { throw new XMLUnitRuntimeException(e.getMessage(), e.getCause()); } }
private static Document stripWhiteSpaceUsingXSLT(Document forDoc) { try { Transform whitespaceStripper = getStripWhitespaceTransform(forDoc); return whitespaceStripper.getResultDocument(); } catch (TransformerException e) { throw new XMLUnitRuntimeException(e.getMessage(), e.getCause()); } }
/** * Get a string identifying the location of an error. * * @param err the exception containing the location information * @return a message string describing the location */ public String getLocationMessage(TransformerException err) { SourceLocator loc = err.getLocator(); while (loc == null) { if (err.getException() instanceof TransformerException) { err = (TransformerException) err.getException(); loc = err.getLocator(); } else if (err.getCause() instanceof TransformerException) { err = (TransformerException) err.getCause(); loc = err.getLocator(); } else { return ""; } } return getLocationMessageText(loc); }
/** * Removes all comment nodes if {@link XMLUnit#getIgnoreComments * comments are ignored}. * * @param orig a document making up one half of this difference * @return manipulated doc */ private Document getCommentlessDocument(Document orig) { if (!XMLUnit.getIgnoreComments()) { return orig; } try { Transform commentStripper = XMLUnit.getStripCommentsTransform(orig); return commentStripper.getResultDocument(); } catch (TransformerException e) { throw new XMLUnitRuntimeException(e.getMessage(), e.getCause()); } }