[CSV]: Ignore newline in record value while using Apache Common CSV?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[CSV]: Ignore newline in record value while using Apache Common CSV?

piyush gajjariya
Hi All,

Anyone knows how to address issue mentioned in below post?

https://stackoverflow.com/questions/48501028/ignore-newline-in-record-value-while-using-apache-common-csv

-Piyush
Reply | Threaded
Open this post in threaded view
|

Re: [CSV]: Ignore newline in record value while using Apache Common CSV?

garydgregory
I replied on SO.

Gary

On Mon, Jan 29, 2018 at 9:59 AM, piyush gajjariya <
[hidden email]> wrote:

> Hi All,
>
> Anyone knows how to address issue mentioned in below post?
>
> https://stackoverflow.com/questions/48501028/ignore-
> newline-in-record-value-while-using-apache-common-csv
>
> -Piyush
>
Reply | Threaded
Open this post in threaded view
|

Re: [CSV]: Ignore newline in record value while using Apache Common CSV?

garydgregory
You can also submit a unit test patch if you think you can demonstrate a
bug.

Gary

On Mon, Jan 29, 2018 at 2:02 PM, Gary Gregory <[hidden email]>
wrote:

> I replied on SO.
>
> Gary
>
> On Mon, Jan 29, 2018 at 9:59 AM, piyush gajjariya <
> [hidden email]> wrote:
>
>> Hi All,
>>
>> Anyone knows how to address issue mentioned in below post?
>>
>> https://stackoverflow.com/questions/48501028/ignore-newline-
>> in-record-value-while-using-apache-common-csv
>>
>> -Piyush
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [CSV]: Ignore newline in record value while using Apache Common CSV?

piyush gajjariya
In reply to this post by garydgregory
Hi Gary,

Thanks for reply. i replied below to your reply in thread
https://stackoverflow.com/questions/48501028/ignore-newline-in-record-value-while-using-apache-common-csv.
can you please suggest any work-around?

If i don't give  withQuote(null) as below then i am getting this run time
exception " (line 12494) invalid char between encapsulated token and
delimiter". which looks this issue
https://stackoverflow.com/questions/26729799/invalid-char-between-encapsulated-token-and-delimiter-in-apache-commons-csv-libr
so i added withQuote(null) to fix that.

CSVParser parser = CSVParser.parse(reader,
CSVFormat.RFC4180.withFirstRecordAsHeader());

Exception:

Exception in thread "main" java.lang.IllegalStateException: IOException
reading next record: java.io.IOException: (line 12494) invalid char between
encapsulated token and delimiter
at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:530)
at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:540)

Any other work-around of this?

On Tue, Jan 30, 2018 at 2:32 AM, Gary Gregory <[hidden email]>
wrote:

> I replied on SO.
>
> Gary
>
> On Mon, Jan 29, 2018 at 9:59 AM, piyush gajjariya <
> [hidden email]> wrote:
>
> > Hi All,
> >
> > Anyone knows how to address issue mentioned in below post?
> >
> > https://stackoverflow.com/questions/48501028/ignore-
> > newline-in-record-value-while-using-apache-common-csv
> >
> > -Piyush
> >
>