You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No exception thrown when patching. An easy fix may be to just update Integer.parseInt() calls to Long.parseLong() everywhere used.
Actual Behavior
NumberFormatException thrown.
Steps to Reproduce the Problem
On a map with a key that is numeric but larger than an Integer, attempt to generate a patch.
Specifications
On versions after 0.4.6, on the below line in JsonDiff, it calls into isArrayIndex() rather than doing the previous instanceOf check. Since there is no validation check that this is in fact an array or that it is an Integer it will fail.
if (pseudo.getPath().get(pseudo.getPath().size() - 1).isArrayIndex()) {
Stack trace from 0.4.11
java.lang.NumberFormatException: For input string: "235234235616"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:583)
at java.lang.Integer.parseInt(Integer.java:615)
at com.flipkart.zjsonpatch.JsonPointer$RefToken.isArrayIndex(JsonPointer.java:302)
at com.flipkart.zjsonpatch.JsonDiff.updatePath(JsonDiff.java:291)
at com.flipkart.zjsonpatch.JsonDiff.computeRelativePath(JsonDiff.java:260)
at com.flipkart.zjsonpatch.JsonDiff.introduceMoveOperation(JsonDiff.java:211)
at com.flipkart.zjsonpatch.JsonDiff.asJson(JsonDiff.java:64)
at com.flipkart.zjsonpatch.JsonDiff.asJson(JsonDiff.java:46)
Library Version:
Language (e.g. Java 1.8, Scala, etc): Java
The text was updated successfully, but these errors were encountered:
Expected Behavior
No exception thrown when patching. An easy fix may be to just update Integer.parseInt() calls to Long.parseLong() everywhere used.
Actual Behavior
NumberFormatException thrown.
Steps to Reproduce the Problem
On a map with a key that is numeric but larger than an Integer, attempt to generate a patch.
Specifications
On versions after 0.4.6, on the below line in JsonDiff, it calls into isArrayIndex() rather than doing the previous instanceOf check. Since there is no validation check that this is in fact an array or that it is an Integer it will fail.
zjsonpatch/src/main/java/com/flipkart/zjsonpatch/JsonDiff.java
Line 291 in 581a547
Stack trace from 0.4.11
java.lang.NumberFormatException: For input string: "235234235616"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:583)
at java.lang.Integer.parseInt(Integer.java:615)
at com.flipkart.zjsonpatch.JsonPointer$RefToken.isArrayIndex(JsonPointer.java:302)
at com.flipkart.zjsonpatch.JsonDiff.updatePath(JsonDiff.java:291)
at com.flipkart.zjsonpatch.JsonDiff.computeRelativePath(JsonDiff.java:260)
at com.flipkart.zjsonpatch.JsonDiff.introduceMoveOperation(JsonDiff.java:211)
at com.flipkart.zjsonpatch.JsonDiff.asJson(JsonDiff.java:64)
at com.flipkart.zjsonpatch.JsonDiff.asJson(JsonDiff.java:46)
Library Version:
Language (e.g. Java 1.8, Scala, etc): Java
The text was updated successfully, but these errors were encountered: