[Pharo-users] Re: NeoCSVReader and wrong number of fieldAccessors

2021-01-04 Thread jtuc...@objektfabrik.de
Sven, first of all thanks a lot for taking your time with this! Your test case is so beautifully small I can't believe it ;-) While I think some kind of validation could help with parsing CSV, I remember reading your comment on this in some other discussion long ago. You wrote you don't see i

[Pharo-users] Re: NeoCSVReader and wrong number of fieldAccessors

2021-01-04 Thread jtuc...@objektfabrik.de
Paul, thank you very much for this idea. Your suggestion is probably "good enough" to at least catch errors when the number of columns doesn't match in the whole file or the first row. For my use case, it wouldn't make any difference if the first row contains header information or not. There

[Pharo-users] Re: NeoCSVReader and wrong number of fieldAccessors

2021-01-04 Thread Sven Van Caekenberghe
Hi Joachim, Thanks for the detailed feedback. This is most helpful. I need to think more about this and experiment a bit. This is what I came up with in a Workspace/Playground: input := 'foo,1 bar,2 foobar,3'. (NeoCSVReader on: input readStream) upToEnd. (NeoCSVReader on: input readStream) add

[Pharo-users] Re: NeoCSVReader and wrong number of fieldAccessors

2021-01-04 Thread Paul DeBruicker
After instantiating the reader and before doing the reading you can #readHeader and check that the reader field count and header field count match. Would that help? If the CSV doesn't use headers then you can process the "header" as the first record and then process the rest of the file. jt

[Pharo-users] Re: NeoCSVReader and wrong number of fieldAccessors

2021-01-04 Thread jtuc...@objektfabrik.de
Please find attached a small test case to demonstrate what I mean. There is just some nonsense Business Object class and a simple test case in this fileout. Am 04.01.21 um 14:36 schrieb jtuc...@objektfabrik.de: Happy new year to all of you! May 2021 be an increasingly less crazy year than 202

[Pharo-users] NeoCSVReader and wrong number of fieldAccessors

2021-01-04 Thread jtuc...@objektfabrik.de
Happy new year to all of you! May 2021 be an increasingly less crazy year than 2020... I have a question that sounds a bit strange, but we have two effects with NeoCSVReader related to wrong definitions of the reader. One effect is that reading a Stream #upToEnd leads to an endless loop, th