Hi Joachim,

First, thanks for the feedback. 

Second, since you are on a different platform, that might be a factor.

Did you test your problem on Pharo itself ?

Because there are already unit tests specifically for the case you describe:

#testEmptyLastFieldUnquoted
#testEmptyLastFieldQuoted

These obviously pass for Pharo, do they pass for you ?

Maybe your problem case is slightly different though ?

Sven

> On 01 Jul 2015, at 13:40, jtuc...@objektfabrik.de wrote:
> 
> Hi,
> 
> I've tried porting SvenVanCaekenberghe.20 and see the same problems in this 
> version. IN addition to the fix already mentioned, I also had to change 
> readSeparator:
> 
> readSeparator
> 
>    ^self atEnd ifFalse: [self peekFor: separator]
> 
> As far as I can tell by now, this fixes the problem at hand. Any ideas if 
> this is a safe fix?
> 
> Joachim
> 
> 
> Am 01.07.15 um 12:35 schrieb jtuc...@objektfabrik.de:
>> Hi there,
>> 
>> I am on VA Smalltalk and therefor using an older version of NeoCSV 
>> (SvenVanCaekenberghe.14). I found a bug in this old version that is somewhat 
>> special.
>> 
>> It seems NeoCSV cannot handle the situation where the very last field is 
>> just empty AND if there is no trailing CRLF at the end of the file. 
>> Somethinng like this:
>> 
>> SecondLastColumnValue;;<EOF>
>> 
>> In that case, readField fails because it tries to do a readQuotedField or 
>> readUnquotedField, both of which try to read beyond EOF.
>> 
>> So I changed readField to this:
>> 
>> readField
>> 
>>    ^self atEnd "In case the very last field of a file is empty, like 
>> '45;56;;'"
>>        ifTrue: ['']
>>        ifFalse: [self peekQuote ifTrue: [self readQuotedField] ifFalse: 
>> [self readUnquotedField]]
>> 
>> and all seems fine so far.
>> 
>> Side note: My original file has a trailing CrLf but if I upload it via a 
>> browser to a Seaside Server, the Browser cuts off the trailing CrLf (I can 
>> see this in the Browser's Network debugging tools - both in IE and FF) - so 
>> it seems NeoCSV has to be ready for this situation.
>> 
>> Joachim
>> 
>> 
> 
> 
> -- 
> -----------------------------------------------------------------------
> Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
> Fliederweg 1                         http://www.objektfabrik.de
> D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
> 
> 


Reply via email to