flatpack icon indicating copy to clipboard operation
flatpack copied to clipboard

needsQuoting in DelimiterWriter.write is determined incorrectly

Open brentleeper opened this issue 5 years ago • 3 comments

Currently:

final boolean needsQuoting = stringValue.indexOf(delimiter) != -1 // || foundQualifier // || stringValue.indexOf('\n') != -1;

Should be:

final boolean needsQuoting = foundQualifier && (stringValue.indexOf(delimiter) != 1 || stringValue.indexOf("\n") != 1);

Because:

If the qualifier is not found, then you cannot write the qualifier ever.

brentleeper avatar Mar 24 '20 17:03 brentleeper

Currently, even if I set the qualifier in the DelimiterWriterFactory to FPConstants.NO_QUALIFIER, there is still a case where the qualifier will be written. This is incorrect.

brentleeper avatar Mar 24 '20 17:03 brentleeper

Hi

May I ask you to provide a unit test for this and I will fix the issue.

Thanks a lot, that would be great.

Benoit

On Tue, 24 Mar 2020 at 17:32, brentleeper [email protected] wrote:

Currently, even if I set the qualifier in the DelimiterWriterFactory to FPConstants.NO_QUALIFIER, there is still a case where the qualifier will be written. This is incorrect.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Appendium/flatpack/issues/54#issuecomment-603393116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB542KIWNILJKHAPXAGG5TRJDVDXANCNFSM4LS3IEZA .

benoitx avatar Mar 24 '20 17:03 benoitx

First can you help me to understand the purpose of foundQualifier, just to make sure I am understanding correctly

brentleeper avatar Mar 24 '20 17:03 brentleeper