Skip to content

Commit 323b392

Browse files
committed
Backport #142 to 2.9 branch, update release notes
1 parent a9f07bc commit 323b392

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

ion/src/main/java/com/fasterxml/jackson/dataformat/ion/IonParser.java

+2
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ public NumberType getNumberType() throws IOException
276276
} else {
277277
return NumberType.INT;
278278
}
279+
case FLOAT:
280+
return NumberType.DOUBLE;
279281
default:
280282
}
281283
}

ion/src/test/java/com/fasterxml/jackson/dataformat/ion/IonParserTest.java

+20
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
import com.fasterxml.jackson.dataformat.ion.IonParser;
2121

2222
import org.junit.Assert;
23+
24+
import software.amazon.ion.IonReader;
2325
import software.amazon.ion.IonSystem;
2426
import software.amazon.ion.IonValue;
2527
import software.amazon.ion.system.IonSystemBuilder;
2628

29+
import java.io.IOException;
2730
import java.math.BigInteger;
2831
import org.junit.Test;
2932

@@ -55,4 +58,21 @@ public void testGetNumberType() throws Exception {
5558
Assert.assertEquals(JsonToken.VALUE_NUMBER_FLOAT, floatParser.nextToken());
5659
Assert.assertEquals(JsonParser.NumberType.DOUBLE, floatParser.getNumberType());
5760
}
61+
62+
@Test
63+
public void testFloatType() throws IOException
64+
{
65+
final byte[] data = "{ score:0.291e0 }".getBytes();
66+
IonSystem ion = IonSystemBuilder.standard().build();
67+
final IonValue ionFloat = ion.newFloat(Float.MAX_VALUE);
68+
IonReader reader = ionFloat.getSystem().newReader(data, 0, data.length);
69+
// Find the object
70+
reader.next();
71+
// Step into the object
72+
reader.stepIn();
73+
// Step next.
74+
reader.next();
75+
final IonParser floatParser = new IonFactory().createParser(reader);
76+
Assert.assertEquals(JsonParser.NumberType.DOUBLE, floatParser.getNumberType());
77+
}
5878
}

release-notes/CREDITS

+5
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@ Leo Wang (wanglingsong@github)
6868

6969
* Reported #135: Infinite sequence of `END_OBJECT` tokens returned at end of streaming read
7070
(2.9.6)
71+
72+
Michael Milkin (mmilkin@github)
73+
* Reported, Contributed fix for #142: (ion) `IonParser.getNumberType()` returns `null`
74+
for `IonType.FLOAT`
75+
(2.9.7)

release-notes/VERSION

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Project: jackson-datatypes-binaryModules:
88
=== Releases ===
99
------------------------------------------------------------------------
1010

11+
2.9.7 (not yet released)
12+
13+
#142: (ion) `IonParser.getNumberType()` returns `null` for `IonType.FLOAT`
14+
(contributed by Michael M)
15+
1116
2.9.6 (12-Jun-2018)
1217

1318
#93: (cbor) `CBORParser` does not accept "undefined value"

0 commit comments

Comments
 (0)