[jira] [Updated] (CAMEL-12418) camel-consul - High CPU load on events watching
[ https://issues.apache.org/jira/browse/CAMEL-12418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-12418: Summary: camel-consul - High CPU load on events watching (was: High CPU load on events watching) > camel-consul - High CPU load on events watching > --- > > Key: CAMEL-12418 > URL: https://issues.apache.org/jira/browse/CAMEL-12418 > Project: Camel > Issue Type: Bug > Components: camel-consul >Affects Versions: 2.21.0 >Reporter: Viachaslau Tsikhanovich >Priority: Major > > Camel-Consul library expects EventClient to block requests and [passes number > of seconds to block request to > EventClient|https://github.com/apache/camel/blob/camel-2.21.0/components/camel-consul/src/main/java/org/apache/camel/component/consul/endpoint/ConsulEventConsumer.java#L59]. > However Event HTTP Endpoint [does not support Blocking > Queries|https://www.consul.io/api/event.html] and EventClient [ignores passed > queryOptions|https://github.com/rickfast/consul-client/blob/1.1.1/src/main/java/com/orbitz/consul/EventClient.java#L164]. > This results in high CPU usage because ConsulEventConsumer constantly makes > requests to Consul without any delay or blocking. > Maybe some _Thread.sleep_ could be added to _EventWatcher.watch(EventClient > client)_ before _client.listEvents_ call or any other fix to introduce delay > between _listEvents_ requests. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12418) camel-consul - High CPU load on events watching
[ https://issues.apache.org/jira/browse/CAMEL-12418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429275#comment-16429275 ] Claus Ibsen commented on CAMEL-12418: - Yeah that sounds like a good idea. Contributions is welcome to add an option to configure the sleep delay, and have a resonable default of maybe 500 millis or something. > camel-consul - High CPU load on events watching > --- > > Key: CAMEL-12418 > URL: https://issues.apache.org/jira/browse/CAMEL-12418 > Project: Camel > Issue Type: Bug > Components: camel-consul >Affects Versions: 2.21.0 >Reporter: Viachaslau Tsikhanovich >Priority: Major > Fix For: 2.22.0 > > > Camel-Consul library expects EventClient to block requests and [passes number > of seconds to block request to > EventClient|https://github.com/apache/camel/blob/camel-2.21.0/components/camel-consul/src/main/java/org/apache/camel/component/consul/endpoint/ConsulEventConsumer.java#L59]. > However Event HTTP Endpoint [does not support Blocking > Queries|https://www.consul.io/api/event.html] and EventClient [ignores passed > queryOptions|https://github.com/rickfast/consul-client/blob/1.1.1/src/main/java/com/orbitz/consul/EventClient.java#L164]. > This results in high CPU usage because ConsulEventConsumer constantly makes > requests to Consul without any delay or blocking. > Maybe some _Thread.sleep_ could be added to _EventWatcher.watch(EventClient > client)_ before _client.listEvents_ call or any other fix to introduce delay > between _listEvents_ requests. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAMEL-12418) camel-consul - High CPU load on events watching
[ https://issues.apache.org/jira/browse/CAMEL-12418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-12418: Estimated Complexity: Novice (was: Unknown) > camel-consul - High CPU load on events watching > --- > > Key: CAMEL-12418 > URL: https://issues.apache.org/jira/browse/CAMEL-12418 > Project: Camel > Issue Type: Bug > Components: camel-consul >Affects Versions: 2.21.0 >Reporter: Viachaslau Tsikhanovich >Priority: Major > Fix For: 2.22.0 > > > Camel-Consul library expects EventClient to block requests and [passes number > of seconds to block request to > EventClient|https://github.com/apache/camel/blob/camel-2.21.0/components/camel-consul/src/main/java/org/apache/camel/component/consul/endpoint/ConsulEventConsumer.java#L59]. > However Event HTTP Endpoint [does not support Blocking > Queries|https://www.consul.io/api/event.html] and EventClient [ignores passed > queryOptions|https://github.com/rickfast/consul-client/blob/1.1.1/src/main/java/com/orbitz/consul/EventClient.java#L164]. > This results in high CPU usage because ConsulEventConsumer constantly makes > requests to Consul without any delay or blocking. > Maybe some _Thread.sleep_ could be added to _EventWatcher.watch(EventClient > client)_ before _client.listEvents_ call or any other fix to introduce delay > between _listEvents_ requests. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAMEL-12418) camel-consul - High CPU load on events watching
[ https://issues.apache.org/jira/browse/CAMEL-12418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-12418: Fix Version/s: 2.22.0 > camel-consul - High CPU load on events watching > --- > > Key: CAMEL-12418 > URL: https://issues.apache.org/jira/browse/CAMEL-12418 > Project: Camel > Issue Type: Bug > Components: camel-consul >Affects Versions: 2.21.0 >Reporter: Viachaslau Tsikhanovich >Priority: Major > Fix For: 2.22.0 > > > Camel-Consul library expects EventClient to block requests and [passes number > of seconds to block request to > EventClient|https://github.com/apache/camel/blob/camel-2.21.0/components/camel-consul/src/main/java/org/apache/camel/component/consul/endpoint/ConsulEventConsumer.java#L59]. > However Event HTTP Endpoint [does not support Blocking > Queries|https://www.consul.io/api/event.html] and EventClient [ignores passed > queryOptions|https://github.com/rickfast/consul-client/blob/1.1.1/src/main/java/com/orbitz/consul/EventClient.java#L164]. > This results in high CPU usage because ConsulEventConsumer constantly makes > requests to Consul without any delay or blocking. > Maybe some _Thread.sleep_ could be added to _EventWatcher.watch(EventClient > client)_ before _client.listEvents_ call or any other fix to introduce delay > between _listEvents_ requests. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429276#comment-16429276 ] Claus Ibsen commented on CAMEL-12415: - I wonder if this is a candidate to backport to 2.21.x branch ? > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAMEL-12411) Support univocity BeanListProcessor
[ https://issues.apache.org/jira/browse/CAMEL-12411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-12411: Issue Type: New Feature (was: Improvement) > Support univocity BeanListProcessor > --- > > Key: CAMEL-12411 > URL: https://issues.apache.org/jira/browse/CAMEL-12411 > Project: Camel > Issue Type: New Feature >Affects Versions: 2.20.2 >Reporter: abccbaandy >Priority: Minor > > I want use BeanListProcessor feature to map vo field with csv header name > https://github.com/uniVocity/univocity-parsers#using-annotations-to-map-your-java-beans > But I can't find any relate option to use this feature, maybe it's not > support in camel univocity? > https://github.com/apache/camel/blob/master/components/camel-univocity-parsers/src/main/docs/univocity-csv-dataformat.adoc > btw, I can't find > {code:java} > camel-univocity-parsers > {code} > in Components selection -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12417) Camel documentation
[ https://issues.apache.org/jira/browse/CAMEL-12417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429284#comment-16429284 ] Terrien Jean-Yves commented on CAMEL-12417: --- Hi, I thought I understood that now the doc was no longer generated on camel.apache.org. But she was directly available on Github. But today, it is impossible to navigate in the document on Github. Maybe I'm wrong. in this case where is the documentation? On camel.apapche.org a note gives a link to github and on github the documentation does not allow to navigate. If in the end the documentation must be on github it is not about internal references but the contrary of external references. A + JYT > Camel documentation > --- > > Key: CAMEL-12417 > URL: https://issues.apache.org/jira/browse/CAMEL-12417 > Project: Camel > Issue Type: Improvement >Affects Versions: 2.21.0 >Reporter: Terrien Jean-Yves >Priority: Major > > I am rewriting the doc to fit github. > [https://github.com/jyterrien/camel/blob/master/readme.adoc] > I replaced .md files with .adoc > I started correcting the links in readme.adoc contributing.adoc > and in camel-core. (in alphabetic order from bean-component to file-component) > I did not find, on github, docs like > https://camel.apache.org/data-format.html > [https://camel.apache.org/enterprise-integration-patterns.html] > > in every page I've changed the definition > = title page > I'e added > :toc: left > and I corrected the links <> link:doc.adoc[Doc] > I also when I found the target corrected the relative links like : > === See Also > * link:file-language.adoc[File Language] > * link:../../../../components/camel-ftp/src/main/docs/ftp-component.adoc[FTP] > * Polling Consumer > as soon as I corrected all camel-core I think to make a pull-request -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429421#comment-16429421 ] Alex Dettinger commented on CAMEL-12415: Indeed, it's safe. I will backport. > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Reopened] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alex Dettinger reopened CAMEL-12415: Will backport to maintenance branches 2.21.x and 2.20.x. > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.20.4, 2.21.1, 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alex Dettinger updated CAMEL-12415: --- Fix Version/s: 2.21.1 2.20.4 > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.20.4, 2.21.1, 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429423#comment-16429423 ] Alex Dettinger edited comment on CAMEL-12415 at 4/7/18 3:45 PM: Will backport to maintenance branches 2.21.x. was (Author: aldettinger): Will backport to maintenance branches 2.21.x and 2.20.x. > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.21.1, 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alex Dettinger updated CAMEL-12415: --- Fix Version/s: (was: 2.20.4) > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.21.1, 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (CAMEL-12415) Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong data
[ https://issues.apache.org/jira/browse/CAMEL-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alex Dettinger closed CAMEL-12415. -- Resolution: Fixed ok, merged into master and camel-2.21.x > Camel-jaxb option "encoding" with option "filterNonXmlChars" generate wrong > data > > > Key: CAMEL-12415 > URL: https://issues.apache.org/jira/browse/CAMEL-12415 > Project: Camel > Issue Type: Bug > Components: camel-jaxb >Affects Versions: 2.21.0 > Environment: OS X 13.3, Java 8 >Reporter: Jonas Waage >Assignee: Alex Dettinger >Priority: Minor > Fix For: 2.21.1, 2.22.0 > > > When using the jaxb-component to marshal. > The properties: > * Encoding > * FilterNonXmlChars > do not work together correctly. > FilterNonXmlChars will ignore the set encoding, and make the output bytes > UTF-8 encoded. > I would either expect this to just work, and by that I mean bytes should be > encoded as the set encoding, or minimally fail during startup of the route > with an exception explaining that these properties does not work together. > I'd really prefer the first, since I want to use the functionality of both. > I have provided a patch which makes this work.I have done a small refactoring > to not have to duplicate more code. I can rewrite this if it is a problem. > Below is a test which will reproduce the problem. > {code:java} > public class ExplicitEncodingAndXMLCharFilteringTest extends CamelTestSupport > { > @Override > public void setUp() throws Exception { > deleteDirectory("target/charset"); > super.setUp(); > } > @Test > public void testIsoAndCharacterFiltering() throws Exception { > PurchaseOrder order = new PurchaseOrder(); > //Data containing characters ÆØÅæøå that differ in utf-8 and iso + a > spouting whale > String name = > "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5\uD83D\uDC33\uFFFD"; > String expected = "\u00c6\u00d8\u00C5\u00e6\u00f8\u00e5 \uFFFD"; > //Spouting whale has become spaces > order.setName(name); > order.setAmount(123.45); > order.setPrice(2.22); > MockEndpoint result = getMockEndpoint("mock:file"); > result.expectedFileExists("target/charset/output.xml"); > template.sendBody("direct:start", order); > assertMockEndpointsSatisfied(); > JAXBContext jaxbContext = > JAXBContext.newInstance("org.apache.camel.example"); > Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); > InputStream inputStream = new > FileInputStream("target/charset/output.xml"); > Reader reader = new InputStreamReader(inputStream, "ISO-8859-1"); > PurchaseOrder obj = (PurchaseOrder) unmarshaller.unmarshal(reader); > assertEquals(expected, obj.getName()); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > JaxbDataFormat jaxb = new > JaxbDataFormat("org.apache.camel.example"); > jaxb.setFilterNonXmlChars(true); > jaxb.setEncoding("iso-8859-1"); > from("direct:start") > .marshal(jaxb) > > .to("file:target/charset/?fileName=output.xml&charset=iso-8859-1"); > } > }; > } > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)