-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange NumberFormatException when having maps with Long keys #69
Comments
Thanks for raising the issue, please allow me a day to look into the issue, I will get back on it very very soon. |
@MrTetrixx This clearly a bug, line #104 & # 105, should be replaced by Long parsing ( this way it wont lose the necessary precision ). |
You can take over, no problem. Please check if there are any other issues of using unusual keys in a map, like BigDecimal or something. I extended the test with a real assertion: String a = "{" +
" \"map\": {" +
" \"3000000000\": {" +
" \"field\": 3100000000," +
" \"otherField\": 0" +
" }" +
" }" +
" }";
String b = "{" +
" \"map\": {" +
" \"3000000000\": {" +
" \"field\": 3100000000," +
" \"otherField\": 0," +
" \"extraField\": 0" +
" }" +
" }" +
" }";
JsonNode jsonA = objectMapper.readTree(a);
JsonNode jsonB = objectMapper.readTree(b);
JsonNode diff = JsonDiff.asJson(jsonA, jsonB);
assertEquals(Operation.ADD.rfcName(), diff.get(0).get("op").textValue());
assertEquals("/map/3000000000/extraField", diff.get(0).get("path").textValue());
assertEquals("value", diff.get(0).get("value").textValue()); Should this test return a |
@MrTetrixx copy comes over add when you create a field that has a value that is already present on your json. In your case, you are creating a field called "extraField" with the same value as "otherField", so the copy takes "priority". The library basically only generates Add and Remove operations if I am not wrong, then these operations are compacted into replace, move and copy operations. You can control this behavior using Flags |
Yes, I guess I can set the |
@MrTetrixx , i have put the fix in #70 , would you like to test it? |
I have run our data through the diff again and it looks much better. |
I am currently on vacation, I will release it on coming Thursday.
…On Tue, Apr 10, 2018, 1:37 PM MrTetrixx ***@***.***> wrote:
I have run our data through the diff again and it looks much better.
When will the fix be released?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB-YqQ8j8G5H31ezFSps5YfZhipXYmJTks5tnGgvgaJpZM4TFQVA>
.
|
Great, looking forward to it! |
released 0.4.4, please use it. |
Hello, I am using zjsonpatch in a project and I really like it.
I ran some of our data through it and came across a strange error. I have not looked at the zjsonpatch code yet but from the stacktrace it looks like it is doing
Integer.parseInt()
on thatLong
value used as a key in the map.The stacktrace:
Code to replicate the issue:
What makes it strange is that
otherField
orextraField
it works.0
to anything else it works too.The text was updated successfully, but these errors were encountered: