[
https://issues.apache.org/jira/browse/CSV-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16179173#comment-16179173
]
Gary Gregory commented on CSV-217:
----------------------------------
Hi All,
That seems open to interpretation to me: if you look at the definition of
{{Closeable}}, {{Flushable}} and {{OutputStream}} even (which {{CSVPrinter}}
does not extend.) there is no requirement that {{close()}} MUST call
{{flush()}}. These two operation are separate for a reason. You could imaging
wanting to close a resource without flushing in the case where you'd want to
release resources during error handling; without going through the bother of
flushing out bad or inappropriate data for example.
That said, I am open to suggestions here. I wonder if a new API {{close(boolean
flush)}} would work for you. Alternatively, we could have an {{autoFlush}}
setting in {{CSVFformat}}. The {{autoFlush}} default would be {{false}} for
compatibility. Or have both mechanisms, which I would not mind adding or
getting a PR with tests would be better! :-)
No matter which way we go, your call site will have to adapt, today to call
{{flush}} or later to use an alternate mechanism. For 1.x, I think we would
want to maintain compatibility in behavior.
But, again, I am open to hearing what the community has to say on this topic.
Gary
> CsvPrinter doesn't flush on close
> ---------------------------------
>
> Key: CSV-217
> URL: https://issues.apache.org/jira/browse/CSV-217
> Project: Commons CSV
> Issue Type: Bug
> Components: Printer
> Reporter: Korolyov Alexei
> Priority: Minor
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> CsvPrinter doesn't flush data on close. Looks like a bug, for me.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)