Skip to content

Commit

Permalink
FasterXML#2885 adding checks for NaN and Infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
siavashsoleymani committed Oct 19, 2020
1 parent 73c2dec commit 0587da7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class DoubleNode

@Override
public boolean hasFractionalPart() {
return _value % 1 != 0.0;
return !Double.isNaN(_value) && !Double.isInfinite(_value) && _value % 1 != 0.0;
}

@Override public boolean canConvertToInt() {
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/fasterxml/jackson/databind/node/FloatNode.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.fasterxml.jackson.databind.node;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.io.NumberOutput;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;

import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.io.NumberOutput;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
* <code>JsonNode</code> implementation for efficiently containing 32-bit
* `float` values.
Expand Down Expand Up @@ -54,7 +55,7 @@ public class FloatNode extends NumericNode

@Override
public boolean hasFractionalPart() {
return _value % 1 != 0.0;
return !Double.isNaN(_value) && !Double.isInfinite(_value) && _value % 1 != 0.0;
}

@Override public boolean canConvertToInt() {
Expand Down

0 comments on commit 0587da7

Please sign in to comment.