We seem to be subject to a strange bug in our Java environment. We've now had two occurrences of the same "can't happen" exception; in one case the problem occurred 42,551 times over a period of 48 minutes in a running process and then spontaneously cleared itself.
The failing code is triggered by this line:
return String.format("%1d%XY%d", source, System.currentTimeMillis(), quoteID);
where int source = 0
and long quoteID = 44386874
(for example).
The exception is:
java.util.UnknownFormatConversionException: Conversion = 'd'
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2605)
at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2633)
at java.util.Formatter.parse(Formatter.java:2479)
at java.util.Formatter.format(Formatter.java:2413)
at java.util.Formatter.format(Formatter.java:2366)
at java.lang.String.format(String.java:2770)
Checking the code 'd'
should never raise this exception.
The best explanation we've come up with is that the JIT compiler is generating bad bytecode, but on a subsequent re-JIT it writes good code.
Anyone have any experience of ways to work around / diagnose such a problem?
Roger.