commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CSV-152) CSVRecord.isSet() does not check if value is not null
Date Mon, 22 Jun 2015 18:49:01 GMT

     [ https://issues.apache.org/jira/browse/CSV-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benedikt Ritter updated CSV-152:
--------------------------------
    Description: 
Consider:

{code:java}
public boolean isSet(final String name)
{
  return isMapped(name) && mapping.get(name).intValue() < values.length;
}
{code}

The docs say 'and has a value', however, it does not check if values[mapping.get(name)] is
null.

Propose:

{code:java}
public boolean isSet(final String name)
{
  return isMapped(name) && mapping.get(name) < values.length && values[mapping.get(name)]
!= null;
}
{code}

Perhaps a new method 'hasValue' if the above is not desirable?

  was:
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?


> 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:
> {code:java}
> public boolean isSet(final String name)
> {
>   return isMapped(name) && mapping.get(name).intValue() < values.length;
> }
> {code}
> The docs say 'and has a value', however, it does not check if values[mapping.get(name)]
is null.
> Propose:
> {code:java}
> public boolean isSet(final String name)
> {
>   return isMapped(name) && mapping.get(name) < values.length && values[mapping.get(name)]
!= null;
> }
> {code}
> Perhaps a new method 'hasValue' if the above is not desirable?



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

Mime
View raw message