You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by rm...@apache.org on 2019/08/18 17:50:41 UTC

[johnzon] branch master updated: JOHNZON-265 refine isLong algorithm

This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new c159515  JOHNZON-265 refine isLong algorithm
c159515 is described below

commit c159515c7c34c3e8f930cccc3b8c2f1bf93de590
Author: Romain Manni-Bucau <rm...@apache.org>
AuthorDate: Sun Aug 18 19:50:36 2019 +0200

    JOHNZON-265 refine isLong algorithm
---
 .../src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
index 9561cd7..c6f9da8 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java
@@ -948,6 +948,10 @@ public class JsonStreamParserImpl extends JohnzonJsonParserImpl implements JsonC
 
     @Override
     public boolean isFitLong() { // not exact but good enough for most cases
+        if (!isCurrentNumberIntegral) {
+            return false;
+        }
+
         // no buffer overflow - assumes a buffer can hold a long
         // + length <= since max long is 9223372036854775807 and min is -9223372036854775808
         final int len = endOfValueInBuffer - startOfValueInBuffer;