Menu

#121 NaN and BigDecimal - Invalid conversion.

v1.0 (example)
closed-fixed
None
5
2015-12-21
2015-11-24
Raanan Raz
No

I have a ResultSet that has 1 column (double) and the value is 'NaN'

when sending this ResultSet to the writeAll ResultSetHelperService.getColumnValue tries to use getBigDecimal

BigDecimal cannot hold NaN value within...

Error converting value to BigDecimal.
.....
at au.com.bytecode.opencsv.ResultSetHelperService.getColumnValue(ResultSetHelperService.java:134)
at au.com.bytecode.opencsv.ResultSetHelperService.getColumnValues(ResultSetHelperService.java:60)
at au.com.bytecode.opencsv.CSVWriter.writeAll(CSVWriter.java:206)

Discussion

  • Scott Conway

    Scott Conway - 2015-12-20
    • status: open --> closed-fixed
    • assigned_to: Scott Conway
     
  • Scott Conway

    Scott Conway - 2015-12-20

    I Modified the ResultSetHelperService to handle Float and Double data types as Float and Double instead of BigDecimal so it can now handle NaN, Infinity, and -Infinity.

    This is merged in trunk and will be out in the 3.7 release.

    I noticed you are using an old version of opencsv so be warned all the packages changed from au.com.bytecode.opencsv to com.opencsv.

    :)

     
  • Raanan Raz

    Raanan Raz - 2015-12-21

    awesome! thanks a lot! :)

     

Log in to post a comment.