Bad stacktraces when a ExceptionInInitializerError occurs in a java class -------------------------------------------------------------------------
Key: JRUBY-4923 URL: http://jira.codehaus.org/browse/JRUBY-4923 Project: JRuby Issue Type: Bug Components: Java Integration Affects Versions: JRuby 1.5.1, JRuby 1.5 Reporter: Reto Schüttel JRuby produces/prints less-than-optional stack traces when an ExceptionInInitializerError occurs. It merely prints the "initializer-error"-exception, but ignores the more helpful root causes. {code} public class Bar { static { if (1 == (1 + 0)) { throw new RuntimeException("lets cause an init exception"); } } } {code} {code} public class App { public void test() { new Bar(); } } {code} and jruby: {code} java_import 'App' a = App.new a.test {code} See also full example on http://github.com/retoo/jruby-init-exception Ouptut: {code} retoo/App.java:10:in `test': java.lang.ExceptionInInitializerError: null (NativeException) from test.rb:8 {code} Java's own output: {code} Exception in thread "main" java.lang.ExceptionInInitializerError at retoo.App.test(App.java:10) at retoo.App.main(App.java:15) Caused by: java.lang.RuntimeException: lets case an init exception at retoo.Bar.<clinit>(Bar.java:10) ... 2 more {code} As you can see the root cause is also printed with Java. Cheers, Reto Schüttel -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email