require 'tmpdir' fails when embedded in a java app that has messed with the
classpath
-------------------------------------------------------------------------------------
Key: JRUBY-3809
URL: http://jira.codehaus.org/browse/JRUBY-3809
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.3.1
Environment: OS X 10.5.7, Java 5, BSF
Reporter: Adam Murray
Assignee: Thomas E Enebo
Priority: Minor
I'm not sure exactly what the containing Java app is doing to the classpath,
because this works fine in a simple test app I put together, but when I try to
run
require 'tmpdir'
in my embedded app, it failes with IOError -- tmpdir
The problem line is
require 'Win32API'
in tmpdir.rb
Turning on $DEBUG=true I got the following stack trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:558)
at
org.jruby.runtime.load.LoadService.findFileInClasspath(LoadService.java:981)
at
org.jruby.runtime.load.LoadService.findLibraryWithClassloaders(LoadService.java:686)
at org.jruby.runtime.load.LoadService.access$200(LoadService.java:124)
at
org.jruby.runtime.load.LoadService$ClassLoaderSearcher.trySearch(LoadService.java:426)
at
org.jruby.runtime.load.LoadService.findFileForLoad(LoadService.java:266)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:302)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at
org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at
org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at
org.jruby.evaluator.ASTInterpreter.evalClassDefinitionBody(ASTInterpreter.java:196)
at org.jruby.ast.ClassNode.interpret(ClassNode.java:139)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at
org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at
org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at
org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.runInterpreter(Ruby.java:618)
at
org.jruby.javasupport.JavaEmbedUtils$InterpretedEvalUnit.run(JavaEmbedUtils.java:228)
at org.jruby.javasupport.bsf.JRubyEngine.eval(JRubyEngine.java:91)
at org.apache.bsf.BSFManager$5.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.eval(Unknown Source)
I have no idea why this is happening in my environment, and I can't reproduce
it for a test case, but it seems easy enough to fix that
StringIndexOutOfBoundsException. I forked JRuby to play around with it and will
submit a patch if I get something working.
--
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