Attempt to load broken Java class breaks JRuby
----------------------------------------------

                 Key: JRUBY-2030
                 URL: http://jira.codehaus.org/browse/JRUBY-2030
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.1RC1
         Environment: Latest JRuby 1.1RC1
            Reporter: Vladimir Sizikov
            Assignee: Vladimir Sizikov


An attempt to load a Java class that throws exceptions out of initializers or 
have linking problems, leads to java exception that breaks JRuby.

Let's use this java class:
{noformat}
package org;
public class MyTest {
  static {
    if ("vvs".startsWith("vvs")) {
      throw new RuntimeException();
    }
  }
}
{noformat}

Then I compile it:
javac -d . MyTest.java

Then, in jirb:
$CLASSPATH << "."

T = org.MyTest

jirb therminates with long exception:
{noformat}
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.jruby.javasupport.JavaSupport.loadJavaClass(JavaSupport.java:119)
        at org.jruby.javasupport.JavaClass.forName(JavaClass.java:994)
        at org.jruby.javasupport.JavaClass.for_name(JavaClass.java:999)
        at org.jruby.javasupport.Java.get_proxy_class(Java.java:385)
        at org.jruby.javasupport.JavaInvoker$get_proxy_class_FS1.call(Unknown 
Source)
        at 
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:55)
        at 
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:70)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:65)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at 
org.jruby.evaluator.ASTInterpreter.localAsgnNode(ASTInterpreter.java:1242)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:379)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at org.jruby.RubyClass.invoke(RubyClass.java:239)
        at 
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:343)
        at org.jruby.RubyObject.callMethod(RubyObject.java:469)
        at 
org.jruby.javasupport.util.RuntimeHelpers.callMethodMissing(RuntimeHelpers.java:313)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:158)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:301)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at 
org.jruby.evaluator.ASTInterpreter.constDeclNode(ASTInterpreter.java:832)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:316)
        at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1601)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:449)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:217)
        at org.jruby.RubyKernel.eval(RubyKernel.java:764)
        at org.jruby.RubyKernelInvoker$eval_method_1_3.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:65)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1096)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:65)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at 
org.jruby.evaluator.ASTInterpreter.setupArgs(ASTInterpreter.java:2140)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1091)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:65)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:298)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1503)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:443)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.Block.yield(Block.java:114)
        at 
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1803)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:484)
        at 
org.jruby.evaluator.ASTInterpreter.ensureNode(ASTInterpreter.java:1068)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:340)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:310)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1101)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.Block.yield(Block.java:114)
        at 
org.jruby.evaluator.ASTInterpreter.yieldNode(ASTInterpreter.java:1803)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:484)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1503)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:443)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyKernel.loop(RubyKernel.java:955)
        at org.jruby.RubyKernelInvoker$loop_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:101)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:313)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1101)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyKernel.rbCatch(RubyKernel.java:793)
        at org.jruby.RubyKernelInvoker$rbCatch_method_1_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:139)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:313)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1101)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:313)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:658)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:65)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:166)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:301)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:150)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:115)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyKernel.rbCatch(RubyKernel.java:793)
        at org.jruby.RubyKernelInvoker$rbCatch_method_1_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneBlock.call(JavaMethod.java:139)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:313)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1101)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:346)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:77)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:211)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:361)
        at 
ruby.opt.work.jruby_dot_git.bin.jirb.__file__(/opt/work/jruby/bin/jirb:13)
        at ruby.opt.work.jruby_dot_git.bin.jirb.load(/opt/work/jruby/bin/jirb)
        at org.jruby.Ruby.runScript(Ruby.java:485)
        at org.jruby.Ruby.runNormally(Ruby.java:405)
        at org.jruby.Ruby.runFromMain(Ruby.java:285)
        at org.jruby.Main.run(Main.java:142)
        at org.jruby.Main.run(Main.java:88)
        at org.jruby.Main.main(Main.java:79)
Caused by: java.lang.RuntimeException
        at org.MyTest.<clinit>(MyTest.java:9)
        ... 148 more
{noformat}

Fix is coming.


-- 
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

Reply via email to