{"action":"created","issue":{"url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch/issues/69","repository_url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch","labels_url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch/issues/69/comments","events_url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch/issues/69/events","html_url":"https://github.com/flipkart-incubator/zjsonpatch/issues/69","id":310877337,"number":69,"title":"Strange NumberFormatException when having maps with Long keys","user":{"login":"MrTetrixx","id":35962094,"avatar_url":"https://avatars3.githubusercontent.com/u/35962094?v=4","gravatar_id":"","url":"https://api.github.com/users/MrTetrixx","html_url":"https://github.com/MrTetrixx","followers_url":"https://api.github.com/users/MrTetrixx/followers","following_url":"https://api.github.com/users/MrTetrixx/following{/other_user}","gists_url":"https://api.github.com/users/MrTetrixx/gists{/gist_id}","starred_url":"https://api.github.com/users/MrTetrixx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrTetrixx/subscriptions","organizations_url":"https://api.github.com/users/MrTetrixx/orgs","repos_url":"https://api.github.com/users/MrTetrixx/repos","events_url":"https://api.github.com/users/MrTetrixx/events{/privacy}","received_events_url":"https://api.github.com/users/MrTetrixx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-03T15:07:38Z","updated_at":"2018-04-06T20:06:20Z","closed_at":null,"author_association":"NONE","body":"Hello, I am using zjsonpatch in a project and I really like it.\r\n\r\nI 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 that `Long` value used as a key in the map.\r\n\r\n### The stacktrace:\r\n```\r\nException in thread \"main\" java.lang.NumberFormatException: For input string: \"2407321151\"\r\n\tat java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)\r\n\tat java.base/java.lang.Integer.parseInt(Integer.java:652)\r\n\tat java.base/java.lang.Integer.parseInt(Integer.java:770)\r\n\tat com.flipkart.zjsonpatch.JsonDiff.isAllowed(JsonDiff.java:104)\r\n\tat com.flipkart.zjsonpatch.JsonDiff.introduceCopyOperation(JsonDiff.java:76)\r\n\tat com.flipkart.zjsonpatch.JsonDiff.asJson(JsonDiff.java:60)\r\n\tat com.flipkart.zjsonpatch.JsonDiff.asJson(JsonDiff.java:38)\r\n\tat JsonDiffTest.main(JsonDiffTest.java:33)\r\n```\r\n\r\n\r\n### Code to replicate the issue:\r\n```java\r\npublic class JsonDiffTest {\r\n    public static void main(String[] args) throws IOException {\r\n        String a = \"{\\n\" +\r\n                \"    \\\"map\\\": {\\n\" +\r\n                \"      \\\"3000000000\\\": {\\n\" +\r\n                \"        \\\"field\\\": 3100000000,\\n\" +\r\n                \"        \\\"otherField\\\": 0\\n\" +\r\n                \"      }\\n\" +\r\n                \"    }\\n\" +\r\n                \"  }\";\r\n\r\n        String b = \"{\\n\" +\r\n                \"    \\\"map\\\": {\\n\" +\r\n                \"      \\\"3000000000\\\": {\\n\" +\r\n                \"        \\\"field\\\": 3100000000,\\n\" +\r\n                \"        \\\"otherField\\\": 0,\\n\" +\r\n                \"        \\\"extraField\\\": 0\\n\" +\r\n                \"      }\\n\" +\r\n                \"    }\\n\" +\r\n                \"  }\";\r\n\r\n        ObjectMapper mapper = new ObjectMapper();\r\n        JsonNode jsonA = mapper.readTree(a);\r\n        JsonNode jsonB = mapper.readTree(b);\r\n\r\n        JsonDiff.asJson(jsonA, jsonB); // causes above stacktrace\r\n    }\r\n}\r\n```\r\n\r\nWhat makes it strange is that\r\n* if you remove either of `otherField` or `extraField` it works.\r\n* if you change the value of either of the fields with value `0` to anything else it works too.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch/issues/comments/379362765","html_url":"https://github.com/flipkart-incubator/zjsonpatch/issues/69#issuecomment-379362765","issue_url":"https://api.github.com/repos/flipkart-incubator/zjsonpatch/issues/69","id":379362765,"user":{"login":"vishwakarma","id":2070697,"avatar_url":"https://avatars1.githubusercontent.com/u/2070697?v=4","gravatar_id":"","url":"https://api.github.com/users/vishwakarma","html_url":"https://github.com/vishwakarma","followers_url":"https://api.github.com/users/vishwakarma/followers","following_url":"https://api.github.com/users/vishwakarma/following{/other_user}","gists_url":"https://api.github.com/users/vishwakarma/gists{/gist_id}","starred_url":"https://api.github.com/users/vishwakarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishwakarma/subscriptions","organizations_url":"https://api.github.com/users/vishwakarma/orgs","repos_url":"https://api.github.com/users/vishwakarma/repos","events_url":"https://api.github.com/users/vishwakarma/events{/privacy}","received_events_url":"https://api.github.com/users/vishwakarma/received_events","type":"User","site_admin":false},"created_at":"2018-04-06T20:06:20Z","updated_at":"2018-04-06T20:06:20Z","author_association":"MEMBER","body":"@MrTetrixx , i have put the fix in #70 , would you like to test it?"}}
{"actor":{"display_login":"vishwakarma"}}