File tree 2 files changed +17
-4
lines changed
avro/src/main/java/com/fasterxml/jackson/dataformat/avro
protobuf/src/main/java/com/fasterxml/jackson/dataformat/protobuf
2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
1
package com .fasterxml .jackson .dataformat .avro ;
2
2
3
3
import java .io .IOException ;
4
- import java .io .InputStream ;
5
4
import java .io .Writer ;
6
5
import java .math .BigDecimal ;
7
6
@@ -262,9 +261,11 @@ public JsonLocation getCurrentLocation()
262
261
protected void convertNumberToBigDecimal () throws IOException {
263
262
// ParserBase uses _textValue instead of _numberDouble for some reason when NR_DOUBLE is set, but _textValue is not set by setNumber()
264
263
// Catch and use _numberDouble instead
265
- if ((_numTypesValid & NR_DOUBLE ) != 0 && _textValue == null ) {
266
- _numberBigDecimal = BigDecimal .valueOf (_numberDouble );
267
- return ;
264
+ if ((_numTypesValid & NR_DOUBLE ) != 0 ) {
265
+ if (_textValue == null ) {
266
+ _numberBigDecimal = BigDecimal .valueOf (_numberDouble );
267
+ return ;
268
+ }
268
269
}
269
270
super .convertNumberToBigDecimal ();
270
271
}
Original file line number Diff line number Diff line change @@ -1640,6 +1640,18 @@ protected void _checkNumericValue(int expType) throws IOException
1640
1640
_reportError ("Current token (" +_currToken +") not numeric, can not use numeric value accessors" );
1641
1641
}
1642
1642
1643
+ @ Override // since 2.9
1644
+ public boolean isNaN () {
1645
+ if (_currToken == JsonToken .VALUE_NUMBER_FLOAT ) {
1646
+ if ((_numTypesValid & NR_DOUBLE ) != 0 ) {
1647
+ // 10-Mar-2017, tatu: Alas, `Double.isFinite(d)` only added in JDK 8
1648
+ double d = _numberDouble ;
1649
+ return Double .isNaN (d ) || Double .isInfinite (d );
1650
+ }
1651
+ }
1652
+ return false ;
1653
+ }
1654
+
1643
1655
protected void convertNumberToInt () throws IOException
1644
1656
{
1645
1657
// First, converting from long ought to be easy
You can’t perform that action at this time.
0 commit comments