mirror of https://github.com/apache/poi.git
Tolerate Double.NaN when reading .xls files, see Bugzilla 49761
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1033004 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6cc5ed707
commit
81a9293f1c
|
@ -273,7 +273,10 @@ public final class RecordInputStream implements LittleEndianInput {
|
|||
long valueLongBits = readLong();
|
||||
double result = Double.longBitsToDouble(valueLongBits);
|
||||
if (Double.isNaN(result)) {
|
||||
throw new RuntimeException("Did not expect to read NaN"); // (Because Excel typically doesn't write NaN
|
||||
// YK: Excel doesn't write NaN but instead converts the cell type into CELL_TYPE_ERROR.
|
||||
// HSSF prior to version 3.7 had a bug: it could write Double.NaN but could not read such a file back.
|
||||
// This behavior was fixed in POI-3.7.
|
||||
//throw new RuntimeException("Did not expect to read NaN"); // (Because Excel typically doesn't write NaN
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -321,5 +321,10 @@ public final class TestHSSFCell extends BaseTestCell {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HSSF prior to version 3.7 had a bug: it could write a NaN but could not read such a file back.
|
||||
*/
|
||||
public void testReadNaN() {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49761.xls");
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue