Menu

#142 Usage of CsvToBean.getCapturedExceptions() changed

closed
None
5
2021-03-16
2020-11-23
No

This ticket is the result of the discussion on the home page: https://sourceforge.net/p/opencsv/wiki/Home/#0816/2dd5/3a4e

Please see my test code for reproducing the problem:
testCollectExceptionsOk() works
testCollectExceptionsWrongUsage() does not

In Version 3.8 coders may hold a pointer to the CsvToBean.getCapturedExceptions() List and captured exceptions had been added to the list while parsing.
NOW (I don't know the version when this changed) this does no longer work because CsvToBean.getCapturedExceptions() is not just a getter but may delegate to the underlying LineExcecuter.

I am pretty sure that you may not want to fix/change this. But I created the ticket anyway to document that this worked in 3.8 and does not in 5.3...

1 Attachments

Discussion

  • Andrew Rucker Jones

    So that's what you mean! Oh, no, that was never intended usage, and it was rather risky of you to try it, since good coding dictates we shouldn't pass internal structures to the outside world. It should always have been a copy, but I messed that up.

    I will leave this ticket open until I get a chance to document that getCapturedExceptions() does not return consistent results until parsing is over. Thanks for mentioning it.

     
  • Andrew Rucker Jones

    • assigned_to: Andrew Rucker Jones
     
  • Andrew Rucker Jones

    • status: open --> pending
     
  • Andrew Rucker Jones

    This has been documented.

     
  • Andrew Rucker Jones

    • status: pending --> closed
     
  • Andrew Rucker Jones

    5.4 was released a couple of days ago.

     

Log in to post a comment.