Menu

#79 csvwriter exception swallowing

closed
nobody
None
5
2016-06-07
2016-04-16
No

Actually CSVWriter consumes general Writer and it is wrapped by PrintWriter that swallow exception - yes, it has a checkError method to check if everything is fine - but it brings me back to hardware coding when you have to check registers after interruption call.

Anyway - from use cases it could be that underlying Writer fails somewhere in the middle - e.g. FileWriter tried to write a file to a full disk - from point of view of usage everything looks fine. In many many case it is inconvinient to checkError later on - more over the root cause is swallowed.

Therefore I strongly suggest to change API for CSVWriter - methods writeAll/writeNext to throw IOException.

Discussion

  • Scott Conway

    Scott Conway - 2016-06-07
    • status: open --> closed
     
  • Scott Conway

    Scott Conway - 2016-06-07

    In 3.8 we are now using the writer the user passed in instead of wrapping in in a PrintWriter so the user can check for errors or use methods that will return the exception.

     

Log in to post a comment.