Summary
Promote JVM option -XX:+TraceExceptions
from a development flag to a product flag. This allows it to be used in a release build of the JDK.
Problem
When an exception is raised in the JVM, it sets the pending exception in the corresponding Java thread and the exception is re-thrown once JVM operations complete and execution continues running Java code.
However, once execution continues executing Java code it can be difficult to locate the origin of the exception (JVM code).
By enabling the HotSpot option -XX:+TraceExceptions
for product builds, details of JVM-raised exceptions can be shown. This simplifies diagnosis of the actual problem.
Currently, -XX:+TraceException
is only available as a develop option, which means it's only available for debug JVM builds. It cannot be used for JVMs deployed in production:
$ java -XX:+TraceExceptions -version
Error: VM option 'TraceExceptions' is develop and is available only in debug version of VM.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Solution
Promote JVM option -XX:+TraceExceptions
to be available in release JVM builds. By default it will be turned off.
Specification
diff -r 0e48ee44693e -r 47ffd05828f9 src/share/vm/runtime/globals.hpp
--- a/src/share/vm/runtime/globals.hpp Tue Dec 16 12:52:04 2014 +0100
+++ b/src/share/vm/runtime/globals.hpp Tue Dec 16 19:00:24 2014 -0500
@@ -1341,7 +1341,7 @@
develop(bool, TraceClassInitialization, false, \
"Trace class initialization") \
\
- develop(bool, TraceExceptions, false, \
+ product(bool, TraceExceptions, false, \
"Trace exceptions") \
\
develop(bool, TraceICs, false, \