camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Karlsen <davidkarl...@gmail.com>
Subject Re: Problems prettyPrinting JSON after camel 2.14.0 upgrade
Date Sun, 28 Sep 2014 14:52:29 GMT
Did not work with latest published snapshots - but perhaps a successful
build&deploy has not yet completed?

2014-09-27 22:40 GMT+02:00 Babak Vahdat <babak.vahdat@swissonline.ch>:

> Thanks for raising the ticket which is fixed now, both on the master as
> well
> as the 2.14.x branch. Would you mind to give it a shot to see if it works
> for you now?
>
> I also raised another ticket regarding my previous comment about the
> possible improvement
> https://issues.apache.org/jira/browse/CAMEL-7877
>
> Babak
>
> David J. M. Karlsen wrote
> > Created https://issues.apache.org/jira/browse/CAMEL-7874
> >
> >
> > 2014-09-27 17:13 GMT+02:00 Babak Vahdat &lt;
>
> > babak.vahdat@
>
> > &gt;:
> >
> >> Hi,
> >>
> >> I looked a bit into the codebase regarding this and spotted some space
> >> for
> >> improvement:
> >>
> >> - First of all there's a copy/paste typo at the following line (pasted
> >> from
> >> the previous code block):
> >>
> >>
> >>
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java#L175
> >>
> >> As it tries to set the the unmarshalType object value for the
> prettyPrint
> >> property, which is wrong.
> >>
> >> - Secondly with the current codebase it's *only* the JacksonDataFormat
> >> which
> >> *truly* supports the prettyPrint option:
> >>
> >>
> >>
> https://github.com/apache/camel/blob/master/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java#L46
> >>
> >> And *all* the other formats fail to do so (including the default XStream
> >> format), as they don't own any prettyPrint property! The last Gson
> format
> >> below has a wrong naming: 'prettyPrinting' instead of 'prettyPrint'.
> >>
> >>
> >>
> https://github.com/apache/camel/blob/master/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
> >>
> >>
> >>
> https://github.com/apache/camel/blob/master/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
> >>
> >>
> >>
> https://github.com/apache/camel/blob/master/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
> >>
> >> Last but not least, we should better not ignore the case if no setter
> >> method
> >> is found below (IntrospectionSupport#setProperty would return false in
> >> such
> >> a case)
> >>
> >>
> >>
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java#L148
> >>
> >>
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java#L150
> >>
> >> As otherwise we don't know if a given data format *truly* supports a
> >> given
> >> option called x. Currently we would ignore the case if there’s no setX()
> >> setter method on a given dataformat object.
> >>
> >> I guess the current workaround for you is to make use of Jackson:
> >>
> >>
> > <json library="Jackson" prettyPrint="true" .../>
> >>
> >> Would you mind to raise a ticket?
> >>
> >> Babak
> >>
> >> David J. M. Karlsen wrote
> >> > With the config:
> >> >
> > <camel:unmarshal>
> >> >
> >> >
> > <camel:json prettyPrint="true" library="Jackson" />
> >> >
> >> >
> > </camel:unmarshal>
> >> > I get:
> >> >
> >> > .. because of Failed to set property: prettyPrint on:
> >> > org.apache.camel.component.jackson.JacksonDataFormat@77ab22be.
> Reason:
> >> > java.lang.IllegalArgumentException: Could not find a suitable setter
> >> for
> >> > property: prettyPrint as there isn't a setter method with same type:
> >> > [null]
> >> > nor type conversion possible: null
> >> >
> >> >         at
> >> >
> >>
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1364)
> >> >
> >> >         at
> >> >
> >>
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:122)
> >> >
> >> >         at
> >> >
> >>
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:327)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:125)
> >> >
> >> >         at
> >> >
> >>
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
> >> > after this upgrade:
> >> >
> >> > -
> >> >
> > <camel.version>
> >> > 2.13.2
> >> >
> > </camel.version>
> >> > +
> >> >
> > <camel.version>
> >> > 2.14.0
> >> >
> > </camel.version>
> >> >
> >> > jira https://issues.apache.org/jira/browse/CAMEL-7639 says it was
> fixed
> >> > for
> >> > 2.14.0 - but it actually worked before on 2.13.2?
> >> > --
> >> > --
> >> > David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/Problems-prettyPrinting-JSON-after-camel-2-14-0-upgrade-tp5756738p5757104.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
> >
> >
> >
> > --
> > --
> > David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problems-prettyPrinting-JSON-after-camel-2-14-0-upgrade-tp5756738p5757111.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message