camel git commit: CAMEL-10370: Conversion to CxfPayload throws Exception for Non-XML payload
Repository: camel Updated Branches: refs/heads/camel-2.18.x e6d985d2f -> 1df40f5f5 CAMEL-10370: Conversion to CxfPayload throws Exception for Non-XML payload Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1df40f5f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1df40f5f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1df40f5f Branch: refs/heads/camel-2.18.x Commit: 1df40f5f5097eca6c208cdef24be9a75dbcb2510 Parents: e6d985d Author: Stephan Siano Authored: Tue Oct 4 16:25:20 2016 +0200 Committer: Stephan Siano Committed: Thu Oct 6 07:42:56 2016 +0200 -- .../cxf/converter/CxfPayloadConverter.java | 96 +++- .../cxf/converter/CxfPayloadConverterTest.java | 21 + 2 files changed, 73 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1df40f5f/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java -- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java index 1da3fff..5801a7b 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java @@ -36,6 +36,7 @@ import org.w3c.dom.NodeList; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.FallbackConverter; +import org.apache.camel.RuntimeCamelException; import org.apache.camel.StreamCache; import org.apache.camel.TypeConverter; import org.apache.camel.component.cxf.CxfPayload; @@ -123,54 +124,61 @@ public final class CxfPayloadConverter { // use fallback type converter, so we can probably convert into // CxfPayloads from other types if (type.isAssignableFrom(CxfPayload.class)) { -if (!value.getClass().isArray()) { -Source src = null; -// many of the common format that can have a Source created directly -if (value instanceof InputStream) { -src = new StreamSource((InputStream) value); -} else if (value instanceof Reader) { -src = new StreamSource((Reader) value); -} else if (value instanceof String) { -src = new StreamSource(new StringReader((String) value)); -} else if (value instanceof Node) { -src = new DOMSource((Node) value); -} else if (value instanceof Source) { -src = (Source) value; -} -if (src == null) { -// assuming staxsource is preferred, otherwise use the one preferred -TypeConverter tc = registry.lookup(javax.xml.transform.stax.StAXSource.class, value.getClass()); -if (tc == null) { -tc = registry.lookup(Source.class, value.getClass()); +try { +if (!value.getClass().isArray()) { +Source src = null; +// many of the common format that can have a Source created +// directly +if (value instanceof InputStream) { +src = new StreamSource((InputStream)value); +} else if (value instanceof Reader) { +src = new StreamSource((Reader)value); +} else if (value instanceof String) { +src = new StreamSource(new StringReader((String)value)); +} else if (value instanceof Node) { +src = new DOMSource((Node)value); +} else if (value instanceof Source) { +src = (Source)value; +} +if (src == null) { +// assuming staxsource is preferred, otherwise use the +// one preferred +TypeConverter tc = registry.lookup(javax.xml.transform.stax.StAXSource.class, value.getClass()); +if (tc == null) { +tc = registry.lookup(Source.class, value.getClass()); +} +if (tc != null) { +src = tc.convertTo(Source.class, exchange, value); +} } -if (tc != null) { -src = tc.convertTo(Source.class, exchange, value); +if (src !=
camel git commit: CAMEL-10370: Conversion to CxfPayload throws Exception for Non-XML payload
Repository: camel Updated Branches: refs/heads/camel-2.17.x b0d37a924 -> 091855d68 CAMEL-10370: Conversion to CxfPayload throws Exception for Non-XML payload Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/091855d6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/091855d6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/091855d6 Branch: refs/heads/camel-2.17.x Commit: 091855d68cd1ff7f16217f54c5752c16893b624d Parents: b0d37a9 Author: Stephan Siano Authored: Tue Oct 4 16:25:20 2016 +0200 Committer: Stephan Siano Committed: Wed Oct 5 12:16:00 2016 +0200 -- .../cxf/converter/CxfPayloadConverter.java | 96 +++- .../cxf/converter/CxfPayloadConverterTest.java | 21 + 2 files changed, 73 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/091855d6/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java -- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java index 1da3fff..5801a7b 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java @@ -36,6 +36,7 @@ import org.w3c.dom.NodeList; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.FallbackConverter; +import org.apache.camel.RuntimeCamelException; import org.apache.camel.StreamCache; import org.apache.camel.TypeConverter; import org.apache.camel.component.cxf.CxfPayload; @@ -123,54 +124,61 @@ public final class CxfPayloadConverter { // use fallback type converter, so we can probably convert into // CxfPayloads from other types if (type.isAssignableFrom(CxfPayload.class)) { -if (!value.getClass().isArray()) { -Source src = null; -// many of the common format that can have a Source created directly -if (value instanceof InputStream) { -src = new StreamSource((InputStream) value); -} else if (value instanceof Reader) { -src = new StreamSource((Reader) value); -} else if (value instanceof String) { -src = new StreamSource(new StringReader((String) value)); -} else if (value instanceof Node) { -src = new DOMSource((Node) value); -} else if (value instanceof Source) { -src = (Source) value; -} -if (src == null) { -// assuming staxsource is preferred, otherwise use the one preferred -TypeConverter tc = registry.lookup(javax.xml.transform.stax.StAXSource.class, value.getClass()); -if (tc == null) { -tc = registry.lookup(Source.class, value.getClass()); +try { +if (!value.getClass().isArray()) { +Source src = null; +// many of the common format that can have a Source created +// directly +if (value instanceof InputStream) { +src = new StreamSource((InputStream)value); +} else if (value instanceof Reader) { +src = new StreamSource((Reader)value); +} else if (value instanceof String) { +src = new StreamSource(new StringReader((String)value)); +} else if (value instanceof Node) { +src = new DOMSource((Node)value); +} else if (value instanceof Source) { +src = (Source)value; +} +if (src == null) { +// assuming staxsource is preferred, otherwise use the +// one preferred +TypeConverter tc = registry.lookup(javax.xml.transform.stax.StAXSource.class, value.getClass()); +if (tc == null) { +tc = registry.lookup(Source.class, value.getClass()); +} +if (tc != null) { +src = tc.convertTo(Source.class, exchange, value); +} } -if (tc != null) { -src = tc.convertTo(Source.class, exchange, value); +if (src !=
camel git commit: CAMEL-10370: Conversion to CxfPayload throws Exception for Non-XML payload
Repository: camel Updated Branches: refs/heads/master ee78cb64c -> fa007d74a CAMEL-10370: Conversion to CxfPayload throws Exception for Non-XML payload Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fa007d74 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fa007d74 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fa007d74 Branch: refs/heads/master Commit: fa007d74a22ba5d27fd1fbd9b58bc15786ea5280 Parents: ee78cb6 Author: Stephan Siano Authored: Tue Oct 4 16:25:20 2016 +0200 Committer: Stephan Siano Committed: Wed Oct 5 11:11:40 2016 +0200 -- .../cxf/converter/CxfPayloadConverter.java | 96 +++- .../cxf/converter/CxfPayloadConverterTest.java | 21 + 2 files changed, 73 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/fa007d74/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java -- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java index 1da3fff..5801a7b 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java @@ -36,6 +36,7 @@ import org.w3c.dom.NodeList; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.FallbackConverter; +import org.apache.camel.RuntimeCamelException; import org.apache.camel.StreamCache; import org.apache.camel.TypeConverter; import org.apache.camel.component.cxf.CxfPayload; @@ -123,54 +124,61 @@ public final class CxfPayloadConverter { // use fallback type converter, so we can probably convert into // CxfPayloads from other types if (type.isAssignableFrom(CxfPayload.class)) { -if (!value.getClass().isArray()) { -Source src = null; -// many of the common format that can have a Source created directly -if (value instanceof InputStream) { -src = new StreamSource((InputStream) value); -} else if (value instanceof Reader) { -src = new StreamSource((Reader) value); -} else if (value instanceof String) { -src = new StreamSource(new StringReader((String) value)); -} else if (value instanceof Node) { -src = new DOMSource((Node) value); -} else if (value instanceof Source) { -src = (Source) value; -} -if (src == null) { -// assuming staxsource is preferred, otherwise use the one preferred -TypeConverter tc = registry.lookup(javax.xml.transform.stax.StAXSource.class, value.getClass()); -if (tc == null) { -tc = registry.lookup(Source.class, value.getClass()); +try { +if (!value.getClass().isArray()) { +Source src = null; +// many of the common format that can have a Source created +// directly +if (value instanceof InputStream) { +src = new StreamSource((InputStream)value); +} else if (value instanceof Reader) { +src = new StreamSource((Reader)value); +} else if (value instanceof String) { +src = new StreamSource(new StringReader((String)value)); +} else if (value instanceof Node) { +src = new DOMSource((Node)value); +} else if (value instanceof Source) { +src = (Source)value; +} +if (src == null) { +// assuming staxsource is preferred, otherwise use the +// one preferred +TypeConverter tc = registry.lookup(javax.xml.transform.stax.StAXSource.class, value.getClass()); +if (tc == null) { +tc = registry.lookup(Source.class, value.getClass()); +} +if (tc != null) { +src = tc.convertTo(Source.class, exchange, value); +} } -if (tc != null) { -src = tc.convertTo(Source.class, exchange, value); +if (src != null) { +