Fixed the log class typo of XmlConverter
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c112e8f2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c112e8f2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c112e8f2 Branch: refs/heads/master Commit: c112e8f2321e3d1618f1b97f4d2ed7e7c5ea6cc2 Parents: b592f29 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Tue Aug 19 10:50:00 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Tue Aug 19 10:50:31 2014 +0800 ---------------------------------------------------------------------- .../camel/converter/jaxp/XmlConverter.java | 75 ++++++++++---------- 1 file changed, 37 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c112e8f2/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java index 2543de5..37cf7f4 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java +++ b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java @@ -64,7 +64,6 @@ import org.apache.camel.BytesSource; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.StringSource; -import org.apache.camel.builder.xml.XPathBuilder; import org.apache.camel.util.IOHelper; import org.apache.camel.util.ObjectHelper; @@ -74,20 +73,20 @@ import org.slf4j.LoggerFactory; /** * A helper class to transform to and from various JAXB types such as {@link Source} and {@link Document} * - * @version + * @version */ @Converter public class XmlConverter { @Deprecated - //It will be removed in Camel 3.0, please use the Exchange.DEFAULT_CHARSET + //It will be removed in Camel 3.0, please use the Exchange.DEFAULT_CHARSET public static final String DEFAULT_CHARSET_PROPERTY = "org.apache.camel.default.charset"; - + public static final String OUTPUT_PROPERTIES_PREFIX = "org.apache.camel.xmlconverter.output."; public static final String DOCUMENT_BUILDER_FACTORY_FEATURE = "org.apache.camel.xmlconverter.documentBuilderFactory.feature"; public static String defaultCharset = ObjectHelper.getSystemProperty(Exchange.DEFAULT_CHARSET_PROPERTY, "UTF-8"); - private static final Logger LOG = LoggerFactory.getLogger(XPathBuilder.class); - + private static final Logger LOG = LoggerFactory.getLogger(XmlConverter.class); + private DocumentBuilderFactory documentBuilderFactory; private TransformerFactory transformerFactory; @@ -166,8 +165,8 @@ public class XmlConverter { /** * Converts the given Node to a Source - * @throws TransformerException - * @throws ParserConfigurationException + * @throws TransformerException + * @throws ParserConfigurationException * @deprecated use toDOMSource instead */ @Deprecated @@ -177,15 +176,15 @@ public class XmlConverter { /** * Converts the given Node to a Source - * @throws TransformerException - * @throws ParserConfigurationException + * @throws TransformerException + * @throws ParserConfigurationException */ @Converter public DOMSource toDOMSource(Node node) throws ParserConfigurationException, TransformerException { Document document = toDOMDocument(node); return new DOMSource(document); } - + /** * Converts the given Document to a DOMSource */ @@ -224,17 +223,17 @@ public class XmlConverter { } else if (source instanceof BytesSource) { return new String(((BytesSource) source).getData()); } else { - StringWriter buffer = new StringWriter(); + StringWriter buffer = new StringWriter(); if (exchange != null) { // check the camelContext properties first Properties properties = ObjectHelper.getCamelPropertiesWithPrefix(OUTPUT_PROPERTIES_PREFIX, exchange.getContext()); if (properties.size() > 0) { toResult(source, new StreamResult(buffer), properties); return buffer.toString(); - } + } } // using the old way to deal with it - toResult(source, new StreamResult(buffer)); + toResult(source, new StreamResult(buffer)); return buffer.toString(); } } @@ -264,7 +263,7 @@ public class XmlConverter { return buffer.toByteArray(); } } - + /** * Converts the given input Node into text * @@ -274,7 +273,7 @@ public class XmlConverter { public String toString(Node node) throws TransformerException { return toString(node, null); } - + /** * Converts the given input Node into text */ @@ -341,7 +340,7 @@ public class XmlConverter { public SAXSource toSAXSource(String source) throws IOException, SAXException, TransformerException { return toSAXSource(source, null); } - + /** * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). @@ -354,14 +353,14 @@ public class XmlConverter { /** * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). - * @throws XMLStreamException + * @throws XMLStreamException */ @Converter public StAXSource toStAXSource(String source, Exchange exchange) throws XMLStreamException { XMLStreamReader r = new StaxConverter().createXMLStreamReader(new StringReader(source)); return new StAXSource(r); - } - + } + /** * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). @@ -383,7 +382,7 @@ public class XmlConverter { public SAXSource toSAXSource(InputStream source) throws IOException, SAXException, TransformerException { return toSAXSource(source, null); } - + /** * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). @@ -405,14 +404,14 @@ public class XmlConverter { /** * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). - * @throws XMLStreamException + * @throws XMLStreamException */ @Converter public StAXSource toStAXSource(InputStream source, Exchange exchange) throws XMLStreamException { XMLStreamReader r = new StaxConverter().createXMLStreamReader(source, exchange); return new StAXSource(r); } - + /** * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). @@ -426,8 +425,8 @@ public class XmlConverter { /** * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). - * @throws FileNotFoundException - * @throws XMLStreamException + * @throws FileNotFoundException + * @throws XMLStreamException */ @Converter public StAXSource toStAXSource(File file, Exchange exchange) throws FileNotFoundException, XMLStreamException { @@ -446,7 +445,7 @@ public class XmlConverter { public SAXSource toSAXSource(Source source) throws IOException, SAXException, TransformerException { return toSAXSource(source, null); } - + /** * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not * supported (making it easy to derive from this class to add new kinds of conversion). @@ -473,7 +472,7 @@ public class XmlConverter { public StreamSource toStreamSource(Source source) throws TransformerException { return toStreamSource(source, null); } - + @Converter public StreamSource toStreamSource(Source source, Exchange exchange) throws TransformerException { if (source instanceof StreamSource) { @@ -523,7 +522,7 @@ public class XmlConverter { public StreamSource toStreamSourceFromSAX(SAXSource source) throws TransformerException { return toStreamSourceFromSAX(source, null); } - + @Converter public StreamSource toStreamSourceFromSAX(SAXSource source, Exchange exchange) throws TransformerException { InputSource inputSource = source.getInputSource(); @@ -546,7 +545,7 @@ public class XmlConverter { public StreamSource toStreamSourceFromDOM(DOMSource source) throws TransformerException { return toStreamSourceFromDOM(source, null); } - + @Converter public StreamSource toStreamSourceFromDOM(DOMSource source, Exchange exchange) throws TransformerException { String result = toString(source, exchange); @@ -578,7 +577,7 @@ public class XmlConverter { public Reader toReaderFromSource(Source src) throws TransformerException { return toReaderFromSource(src, null); } - + @Converter public Reader toReaderFromSource(Source src, Exchange exchange) throws TransformerException { StreamSource stSrc = toStreamSource(src, exchange); @@ -625,7 +624,7 @@ public class XmlConverter { } return new DOMSource(document, systemId); } - + /** * @deprecated will be removed in Camel 3.0. Use the method which has 2 parameters. */ @@ -633,7 +632,7 @@ public class XmlConverter { public SAXSource toSAXSourceFromDOM(DOMSource source) throws TransformerException { return toSAXSourceFromDOM(source, null); } - + @Converter public SAXSource toSAXSourceFromDOM(DOMSource source, Exchange exchange) throws TransformerException { String str = toString(source, exchange); @@ -671,7 +670,7 @@ public class XmlConverter { toResult(source, result); return result.getNode(); } - + /** * Convert a NodeList consisting of just 1 node to a DOM Node. * @param nl the NodeList @@ -681,7 +680,7 @@ public class XmlConverter { public Node toDOMNodeFromSingleNodeList(NodeList nl) { return nl.getLength() == 1 ? nl.item(0) : null; } - + /** * Convert a NodeList consisting of just 1 node to a DOM Document. * Cannot convert NodeList with length > 1 because they require a root node. @@ -859,7 +858,7 @@ public class XmlConverter { public InputStream toInputStream(DOMSource source) throws TransformerException, IOException { return toInputStream(source, null); } - + @Converter public InputStream toInputStream(DOMSource source, Exchange exchange) throws TransformerException, IOException { return new ByteArrayInputStream(toByteArray(source, exchange)); @@ -872,7 +871,7 @@ public class XmlConverter { public InputStream toInputStream(Document dom) throws TransformerException, IOException { return toInputStream(dom, null); } - + @Converter public InputStream toInputStream(Document dom, Exchange exchange) throws TransformerException, IOException { return toInputStream(new DOMSource(dom), exchange); @@ -916,7 +915,7 @@ public class XmlConverter { // Helper methods //------------------------------------------------------------------------- - + protected void setupFeatures(DocumentBuilderFactory factory) { Properties properties = System.getProperties(); List<String> features = new ArrayList<String>(); @@ -944,7 +943,7 @@ public class XmlConverter { } LOG.info("DocumentBuilderFactory has been set with features {{}}.", featureString.toString()); } - + } public DocumentBuilderFactory createDocumentBuilderFactory() {