I have this stack trace (part of)
Servlet.service() for servlet action threw exception
java.lang.NumberFormatException: For input string: "37648"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:403)
at java.lang.Long.valueOf(Long.java:482)
at java.lang.Long.decode(Long.java:593)
in one of my logfile
I don’t know what was real input string.
But the user had made happen the same stack trace.
How such a stacktrace can happen?
Probably because they have a leading zero in their input.
This runs fine:
But if you change this:
to this:
…it becomes invalid octal, and the exception from
Long.parseLongdoesn’t include the leading zero:It doesn’t include it because
decodecallsparseLongwithout the zero, but with the base set to 8.Talk about obscure. 🙂 So if you update your program to handle the exception by showing the actual input, you’ll probably find it’s something along those lines.