File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 11package com .fasterxml .jackson .dataformat .avro ;
22
33import java .io .IOException ;
4- import java .io .InputStream ;
54import java .io .Writer ;
65import java .math .BigDecimal ;
76
@@ -262,9 +261,11 @@ public JsonLocation getCurrentLocation()
262261 protected void convertNumberToBigDecimal () throws IOException {
263262 // ParserBase uses _textValue instead of _numberDouble for some reason when NR_DOUBLE is set, but _textValue is not set by setNumber()
264263 // 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+ }
268269 }
269270 super .convertNumberToBigDecimal ();
270271 }
Original file line number Diff line number Diff line change @@ -1640,6 +1640,18 @@ protected void _checkNumericValue(int expType) throws IOException
16401640 _reportError ("Current token (" +_currToken +") not numeric, can not use numeric value accessors" );
16411641 }
16421642
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+
16431655 protected void convertNumberToInt () throws IOException
16441656 {
16451657 // First, converting from long ought to be easy
You can’t perform that action at this time.
0 commit comments