How to reproduce:
public static void main(String[] args) {
final String longPropertyAsString = JsonIterator.deserialize("{\"long_property\": 2000, \"foo\": \"bar\"}")
.get("long_property")
.toString();
final Long aLong = Long.valueOf(longPropertyAsString);
}
Which results in:
Exception in thread "main" java.lang.NumberFormatException: For input string: " 2000"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:578)
at java.lang.Long.valueOf(Long.java:803)
at .........
As you can see actual string returned is " 2000" which is kinda counterintuitive, given that I expect a string representation of a number.
How to reproduce:
Which results in:
Exception in thread "main" java.lang.NumberFormatException: For input string: " 2000"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:578)
at java.lang.Long.valueOf(Long.java:803)
at .........
As you can see actual string returned is " 2000" which is kinda counterintuitive, given that I expect a string representation of a number.