[ 
https://issues.apache.org/jira/browse/CSV-152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14588354#comment-14588354
 ] 

Michael Newcomb commented on CSV-152:
-------------------------------------

Upon initial inspection, it looks like the values in CSVRecord are always 
'null' if not present. nullString seems to only come into play when 
reading/writing. When reading, if value == nullString, put null in the 
CSVRecord. When writing, if value == null, write nullString.

I can't checkout/build on this machine, so can't really provide a patch at this 
time.

> CSVRecord.isSet() does not check if value is not null
> -----------------------------------------------------
>
>                 Key: CSV-152
>                 URL: https://issues.apache.org/jira/browse/CSV-152
>             Project: Commons CSV
>          Issue Type: Bug
>            Reporter: Michael Newcomb
>
> Consider:
> public boolean isSet(final String name)
> {
>   return isMapped(name) && mapping.get(name).intValue() < values.length;
> }
> The docs say 'and has a value', however, it does not check if 
> values[mapping.get(name)] is null.
> Propose:
> public boolean isSet(final String name)
> {
>   return isMapped(name) && mapping.get(name) < values.length && 
> values[mapping.get(name)] != null;
> }
> Perhaps a new method 'hasValue' if the above is not desirable?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to