Appendium / flatpack

CSV/Tab Delimited and Fixed Length Parser and Writer
http://flatpack.sf.net
Apache License 2.0
57 stars 20 forks source link

Bug parsing qualified record ending in {delimiter}{qualifier} #17

Closed icemanltd closed 9 years ago

icemanltd commented 9 years ago

In ParserUtils.isMultiLine a check is made to see if the line ends with the qualifier character. If so, the preceding character is compared to the delimiter and if it matches it is assumed the content is multiline data and the two characters (<{delimiter}{qualifier}) are the beginning of the multiline field.

Consider the case though where there is data,data,qualifieddata i.e. comma delimited double quote qualified content such as: some data,some other data,"some,qualified,data,".

The result is that the ending ," are assumed to be the beginning of a multiline field which consumes the rest of the records until some closing {delimiter}{qualifier} is encountered?

I first encountered this in 3.2.0 but confirm the behavior in 4.0.0 as well.

benoitx commented 9 years ago

Would you have a coded test case/JUnit so we could add it to the suite? Thanks

icemanltd commented 9 years ago

I do not have one convenient at the moment but I can put one together.

icemanltd commented 9 years ago

I have added for tests to ParserUtilsTest.java. test qualified non multiline test qualified multiline test non qualified non multiline test non qualified multiline

All pass but the qualified multiline.

Not sure how best to get this incorporated in github?

icemanltd commented 9 years ago

I also have taken a first swipe at correcting the issue. I would be happy to share this and receive any feedback on it.

benoitx commented 9 years ago

By all means, that would be great.

You could fork Master and then create a pull request that incorporate your changes.

@ks-appendium is this correct?

Thanks


Important Notice This communication contains information that is considered confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender and delete the original

On 2 Aug 2015, at 05:40, icemanltd notifications@github.com wrote:

I also have taken a first swipe at correcting the issue. I would be happy to share this and receive any feedback on it.

— Reply to this email directly or view it on GitHub.

icemanltd commented 9 years ago

Yes, I am new to Git but I forked from https://github.com/ks-appendium/flatpack master. I will hopefully be able to push them tonight and submit a pull request.

icemanltd commented 9 years ago

Sorry for the delay but I have created the pull request. Please let me know if there is more I can do. Thank you.

benoitx commented 9 years ago

integrated in 3_4 and master. Thank you for the patch.