List of usage examples for javax.xml.transform TransformerException getMessage
public String getMessage()
From source file:net.sourceforge.vulcan.metrics.XmlMetricsPlugin.java
protected Document transform(Document mergedRoot) { final Element metricsRoot = new Element("metrics"); final Document metrics = new Document(metricsRoot); final JDOMSource source = new JDOMSource(mergedRoot); for (Map.Entry<String, Transformer> key : transformers.entrySet()) { final JDOMResult result = new JDOMResult(); final Transformer transformer = key.getValue(); synchronized (transformer) { try { transformer.transform(source, result); } catch (TransformerException e) { eventHandler.reportEvent( new ErrorEvent(this, "metrics.errors.transform", new Object[] { e.getMessage() }, e)); }//from ww w. j a v a 2 s. com } boolean hasContent = false; if (result.getDocument().hasRootElement()) { final Element root = result.getDocument().getRootElement(); if (root.getContentSize() > 0) { hasContent = true; metricsRoot.addContent(root.cloneContent()); } } if (!hasContent && LOG.isDebugEnabled()) { LOG.debug("Transform " + key.getKey() + " did not produce any metrics."); } } return metrics; }
From source file:com.spoledge.audao.generator.GeneratorFlow.java
public void error(TransformerException e) throws TransformerException { if (log.isDebugEnabled()) { log.debug("error(): " + e.getMessage()); }/*ww w . j av a2 s.c o m*/ storeException(e, GeneratorException.Type.ERROR); }
From source file:com.spoledge.audao.generator.GeneratorFlow.java
public void warning(TransformerException e) throws TransformerException { if (log.isDebugEnabled()) { log.debug("warning(): " + e.getMessage()); }/*from ww w .j av a 2 s .c o m*/ storeException(e, GeneratorException.Type.WARNING); }
From source file:com.spoledge.audao.generator.GeneratorFlow.java
public void fatalError(TransformerException e) throws TransformerException { if (log.isDebugEnabled()) { log.debug("fatalError(): " + e.getMessage()); }//from w w w .j a v a 2 s. c o m storeException(e, GeneratorException.Type.FATAL_ERROR); isFatalError = true; }
From source file:com.espertech.esper.client.ConfigurationParser.java
private static void handlePluginLoaders(Configuration configuration, Element element) { String loaderName = getRequiredAttribute(element, "name"); String className = getRequiredAttribute(element, "class-name"); Properties properties = new Properties(); String configXML = null;//from ww w .ja v a 2s .com DOMElementIterator nodeIterator = new DOMElementIterator(element.getChildNodes()); while (nodeIterator.hasNext()) { Element subElement = nodeIterator.next(); if (subElement.getNodeName().equals("init-arg")) { String name = getRequiredAttribute(subElement, "name"); String value = getRequiredAttribute(subElement, "value"); properties.put(name, value); } if (subElement.getNodeName().equals("config-xml")) { DOMElementIterator nodeIter = new DOMElementIterator(subElement.getChildNodes()); if (!nodeIter.hasNext()) { throw new ConfigurationException("Error handling config-xml for plug-in loader '" + loaderName + "', no child node found under initializer element, expecting an element node"); } StringWriter output = new StringWriter(); try { TransformerFactory.newInstance().newTransformer().transform(new DOMSource(nodeIter.next()), new StreamResult(output)); } catch (TransformerException e) { throw new ConfigurationException( "Error handling config-xml for plug-in loader '" + loaderName + "' :" + e.getMessage(), e); } configXML = output.toString(); } } configuration.addPluginLoader(loaderName, className, properties, configXML); }
From source file:com.espertech.esper.client.ConfigurationParser.java
private static void handlePlugInEventType(Configuration configuration, Element element) { DOMElementIterator nodeIterator = new DOMElementIterator(element.getChildNodes()); List<URI> uris = new ArrayList<URI>(); String name = getRequiredAttribute(element, "name"); String initializer = null;/*from ww w . jav a2 s .c o m*/ while (nodeIterator.hasNext()) { Element subElement = nodeIterator.next(); if (subElement.getNodeName().equals("resolution-uri")) { String uriValue = getRequiredAttribute(subElement, "value"); URI uri; try { uri = new URI(uriValue); } catch (URISyntaxException ex) { throw new ConfigurationException("Error parsing URI '" + uriValue + "' as a valid java.net.URI string:" + ex.getMessage(), ex); } uris.add(uri); } if (subElement.getNodeName().equals("initializer")) { DOMElementIterator nodeIter = new DOMElementIterator(subElement.getChildNodes()); if (!nodeIter.hasNext()) { throw new ConfigurationException("Error handling initializer for plug-in event type '" + name + "', no child node found under initializer element, expecting an element node"); } StringWriter output = new StringWriter(); try { TransformerFactory.newInstance().newTransformer().transform(new DOMSource(nodeIter.next()), new StreamResult(output)); } catch (TransformerException e) { throw new ConfigurationException( "Error handling initializer for plug-in event type '" + name + "' :" + e.getMessage(), e); } initializer = output.toString(); } } configuration.addPlugInEventType(name, uris.toArray(new URI[uris.size()]), initializer); }
From source file:com.espertech.esper.client.ConfigurationParser.java
private static void handlePlugInEventRepresentation(Configuration configuration, Element element) { DOMElementIterator nodeIterator = new DOMElementIterator(element.getChildNodes()); String uri = getRequiredAttribute(element, "uri"); String className = getRequiredAttribute(element, "class-name"); String initializer = null;//w ww .ja va 2 s. c om while (nodeIterator.hasNext()) { Element subElement = nodeIterator.next(); if (subElement.getNodeName().equals("initializer")) { DOMElementIterator nodeIter = new DOMElementIterator(subElement.getChildNodes()); if (!nodeIter.hasNext()) { throw new ConfigurationException("Error handling initializer for plug-in event representation '" + uri + "', no child node found under initializer element, expecting an element node"); } StringWriter output = new StringWriter(); try { TransformerFactory.newInstance().newTransformer().transform(new DOMSource(nodeIter.next()), new StreamResult(output)); } catch (TransformerException e) { throw new ConfigurationException("Error handling initializer for plug-in event representation '" + uri + "' :" + e.getMessage(), e); } initializer = output.toString(); } } URI uriParsed; try { uriParsed = new URI(uri); } catch (URISyntaxException ex) { throw new ConfigurationException( "Error parsing URI '" + uri + "' as a valid java.net.URI string:" + ex.getMessage(), ex); } configuration.addPlugInEventRepresentation(uriParsed, className, initializer); }
From source file:net.sf.joost.trax.ConfigurationErrListener.java
/** * Receive notification of a recoverable error. * Details {@link ErrorListener#error}// w w w .j a v a 2s . co m */ public void error(TransformerException tE) throws TransformerConfigurationException { if (userErrorListener != null) { try { userErrorListener.error(tE); } catch (TransformerException e2) { if (log != null) log.error(e2); if (e2 instanceof TransformerConfigurationException) { throw (TransformerConfigurationException) tE; } else { throw new TransformerConfigurationException(tE.getMessage(), tE); } } } else { if (log != null) log.error(tE); // no user defined errorlistener, so throw this exception if (tE instanceof TransformerConfigurationException) { throw (TransformerConfigurationException) tE; } else { throw new TransformerConfigurationException(tE.getMessage(), tE); } } }
From source file:net.sf.joost.trax.ConfigurationErrListener.java
/** * Receive notification of a warning./* w w w . ja va2s .co m*/ * Details {@link ErrorListener#warning} */ public void warning(TransformerException tE) throws TransformerConfigurationException { if (userErrorListener != null) { try { userErrorListener.warning(tE); } catch (TransformerException e2) { if (log != null) log.warn(e2); if (e2 instanceof TransformerConfigurationException) { throw (TransformerConfigurationException) tE; } else { throw new TransformerConfigurationException(tE.getMessage(), tE); } } } else { if (log != null) log.warn(tE); // no user defined errorlistener, so throw this exception if (tE instanceof TransformerConfigurationException) { throw (TransformerConfigurationException) tE; } else { throw new TransformerConfigurationException(tE.getMessage(), tE); } } }
From source file:net.sf.joost.trax.ConfigurationErrListener.java
/** * Receive notification of a non-recoverable error. * Details {@link ErrorListener#fatalError} *///from ww w. ja va 2 s .co m public void fatalError(TransformerException tE) throws TransformerConfigurationException { if (userErrorListener != null) { try { userErrorListener.fatalError(tE); } catch (TransformerException e2) { if (log != null) log.fatal(e2); if (e2 instanceof TransformerConfigurationException) { throw (TransformerConfigurationException) tE; } else { throw new TransformerConfigurationException(tE.getMessage(), tE); } } } else { if (log != null) log.fatal(tE); // no user defined errorlistener, so throw this exception if (tE instanceof TransformerConfigurationException) { throw (TransformerConfigurationException) tE; } else { throw new TransformerConfigurationException(tE.getMessage(), tE); } } }