You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/08/19 04:51:40 UTC
[1/3] git commit: Fixed the log class typo of XmlConverter
Repository: camel
Updated Branches:
refs/heads/camel-2.12.x a6227486c -> b5629d844
refs/heads/camel-2.13.x a6d75c580 -> 5a47eefb4
refs/heads/master b592f2967 -> c112e8f23
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/b5629d84
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b5629d84
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b5629d84
Branch: refs/heads/camel-2.12.x
Commit: b5629d8449856e78af0ddb071663088d514fda40
Parents: a622748
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Aug 19 10:50:00 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Aug 19 10:50:00 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/b5629d84/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() {
[2/3] git commit: Fixed the log class typo of XmlConverter
Posted by ni...@apache.org.
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 <wi...@gmail.com>
Authored: Tue Aug 19 10:50:00 2014 +0800
Committer: Willem Jiang <wi...@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() {
[3/3] git commit: Fixed the log class typo of XmlConverter
Posted by ni...@apache.org.
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/5a47eefb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5a47eefb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5a47eefb
Branch: refs/heads/camel-2.13.x
Commit: 5a47eefb4ab915c7acc7dab3e54cd0c9c885cb62
Parents: a6d75c5
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Aug 19 10:50:00 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Aug 19 10:51:14 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/5a47eefb/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() {