/** * {@inheritDoc} */ public void warning(TransformerException exc) { log.warn(exc.getLocalizedMessage()); }
/** * {@inheritDoc} */ public void warning(TransformerException exc) { log.warn(exc.getLocalizedMessage()); }
/** * Creates an XML string from the given annotated string. * * @param input * the annotated string * @return an XML String * @exception ProcessingException * if an error occurs */ public static String createXmlString(AnnotatedString input) { // tokenize text Document doc = createXmlDocument(input); // init output writer for result StringWriter out = new StringWriter(); // use a transformer for output try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(out); transformer.transform(source, result); } catch (TransformerException te) { throw new ProcessingException(te.getLocalizedMessage(), te); } // return result return out.toString(); }
out.close(); } catch (TransformerException te) { throw new ProcessingException(te.getLocalizedMessage(), te); } catch (IOException ioe) { throw new ProcessingException(ioe.getLocalizedMessage(), ioe);
System.out.println(exception.getLocalizedMessage()); exception.printStackTrace();
System.out.println(exception.getLocalizedMessage()); exception.printStackTrace();
transformer.transform(source, consoleResult); } catch (TransformerException ex) { logger.warning("Unable to print sitemap to the console: " + ex.getLocalizedMessage()); transformer.transform(source, result); } catch (TransformerException ex) { logger.warning("Unable to update sitemap! Unable to write staged sitemap to " + stagedSitemapPathAndFileString + ". TransformerException: " + ex.getLocalizedMessage()); return;
Level.FINE, "Exception occurred while transforming the style " + e.getLocalizedMessage(), e);
/** * @param Rule object * @return a string with json rule representation */ private JSONObject jsonRule(Object obj) { JSONObject jsonObj = null; String xmlRule; XMLSerializer xmlS = new XMLSerializer(); SLDTransformer transform = new SLDTransformer(); transform.setIndentation(2); try { xmlRule = transform.transform(obj); xmlS.setRemoveNamespacePrefixFromElements(true); xmlS.setSkipNamespaces(true); jsonObj = (JSONObject) xmlS.read(xmlRule); } catch (TransformerException e) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.log( Level.FINE, "Exception occurred while transforming the rule " + e.getLocalizedMessage(), e); } return jsonObj; }
Level.FINE, "Exception occurred while transforming the style " + e.getLocalizedMessage(), e);
} catch (TransformerException e) {// Can happen for incorrect XPath expression if (log.isWarnEnabled()) { log.warn("TransformerException while processing ({}). {}", getXPathQuery(), e.getLocalizedMessage());
logger.warn(ex.getLocalizedMessage()); } catch (TransformerException ex) { logger.warn(ex.getLocalizedMessage());