You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mdo <ma...@gmail.com> on 2013/04/04 12:23:33 UTC

CSV component and Mac line endings (carriage return only)

Hello,

I tried to parse some CSV files that have only carriage returns as line
ending (like some legacy Mac apps produce) instead of \r\n or \n. Obviously
this is not supported at the moment (but I applied a workaround for now by
using a regexReplaceAll on the streamed CSV contents in the Camel route).

There was an issue in Commons CSV that was fixed a while back:
<https://issues.apache.org/jira/browse/CSV-22>

While this was committed in revision 1065496 in Commons CSV Camel depends on
an artifact org.apache.servicemix.bundles.commons-csv and I was not able to
figure out if the change was merged.

Camel depends on version 1.0-r706899_5 of the Servicemix bundle while the
latest version of Commons CSV seems to be 706900_3.

At
<http://repo.maven.apache.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-csv/>
I've found a 1.0-r706900_3 but that dates back before the patch date
obviously.

Can anyone comment if this is an issue of the Servicemix bundle or the
dependency version in Camel?


Regards, mdo.






--
View this message in context: http://camel.465427.n5.nabble.com/CSV-component-and-Mac-line-endings-carriage-return-only-tp5730323.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CSV component and Mac line endings (carriage return only)

Posted by Babak Vahdat <ba...@swissonline.ch>.
I think what Henryk has explained there in that thread is about *his own
code* he intends to donate to Apache Camel in the future.

Babak


mdo wrote
> Hey Babak,
> 
> thanks for your comprehensive answer!
> 
> I tried Bindy before, but for my use case I preferred the CSV component
> because it delivered a simple string list and I did not have to supply a
> mapping to a Java class.
> 
> BeanIO also is about mapping to POJOs as far as I see.
> 
> I saw a thread
> (&lt;http://camel.465427.n5.nabble.com/How-to-escape-commas-in-CSV-file-td5729241.html&gt;)
> where hekonsek talked about another component -- camel-csv-simple data
> format. As I saw that both of you are committers: do you know something
> about the state of this component?
> 
> Maybe I stick with the CSV component for now and use my workaround.
> 
> Best regards, mdo.





--
View this message in context: http://camel.465427.n5.nabble.com/CSV-component-and-Mac-line-endings-carriage-return-only-tp5730323p5730384.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CSV component and Mac line endings (carriage return only)

Posted by mdo <ma...@gmail.com>.
Hey Babak,

thanks for your comprehensive answer!

I tried Bindy before, but for my use case I preferred the CSV component
because it delivered a simple string list and I did not have to supply a
mapping to a Java class.

BeanIO also is about mapping to POJOs as far as I see.

I saw a thread
(<http://camel.465427.n5.nabble.com/How-to-escape-commas-in-CSV-file-td5729241.html>)
where hekonsek talked about another component -- camel-csv-simple data
format. As I saw that both of you are committers: do you know something
about the state of this component?

Maybe I stick with the CSV component for now and use my workaround.

Best regards, mdo.





--
View this message in context: http://camel.465427.n5.nabble.com/CSV-component-and-Mac-line-endings-carriage-return-only-tp5730323p5730368.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CSV component and Mac line endings (carriage return only)

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

No the version 1.0-r706899_5 is the most recent version of this SMX bundle
and *not* 1.0-r706900_3, as you can see from it's POM history:

http://svn.apache.org/viewvc/servicemix/smx4/bundles/trunk/commons-csv-1.0/pom.xml?view=log

Other way is to check the file timestamp of the different versions:

http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.servicemix.bundles%22%20AND%20a%3A%22org.apache.servicemix.bundles.commons-csv%22

So don't let the (poor) version namings being used here irritate you.

Camel 2.10.x relies on 1.0-r706900_3 however the upcoming Camel 2.11 release
makes use of the latest version 1.0-r706899_5 as you see here:

http://camel.apache.org/camel-2110-release.html#Camel2.11.0Release-DependencyUpgrades

I checked the source of the latest SMX bundle (1.0-r706899_5) and the fix of
that JIRA ticket you posted in *not* included either.

I'm not really sure if the SMX folks would provide a newer bundle including
that fix as apache-commons-csv is dead and not active anymore, more details
here:

http://commons.apache.org/proper/commons-csv/index.html

I also didn't find that fix being mentioned as committed inside the trunk
code:

http://svn.apache.org/repos/asf/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java

But maybe that fix of JIRA ticket has been committed somewhere else, don't
know.

There're also other Camel data formats like BeanIO or Bindy you could make
use of for the CSV (de)marshalling:

http://camel.apache.org/beanio.html
http://camel.apache.org/bindy.html

Babak


mdo wrote
> Hello,
> 
> I tried to parse some CSV files that have only carriage returns as line
> ending (like some legacy Mac apps produce) instead of \r\n or \n.
> Obviously this is not supported at the moment (but I applied a workaround
> for now by using a regexReplaceAll on the streamed CSV contents in the
> Camel route).
> 
> There was an issue in Commons CSV that was fixed a while back:
> &lt;https://issues.apache.org/jira/browse/CSV-22&gt;
> 
> While this was committed in revision 1065496 in Commons CSV Camel depends
> on an artifact org.apache.servicemix.bundles.commons-csv and I was not
> able to figure out if the change was merged.
> 
> Camel depends on version 1.0-r706899_5 of the Servicemix bundle while the
> latest version of Commons CSV seems to be 706900_3.
> 
> At
> &lt;http://repo.maven.apache.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-csv/&gt;
> I've found a 1.0-r706900_3 but that dates back before the patch date
> obviously.
> 
> Can anyone comment if this is an issue of the Servicemix bundle or the
> dependency version in Camel?
> 
> 
> Regards, mdo.





--
View this message in context: http://camel.465427.n5.nabble.com/CSV-component-and-Mac-line-endings-carriage-return-only-tp5730323p5730358.html
Sent from the Camel - Users mailing list archive at Nabble.com.