Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 0.9.0
-
Fix Version/s: JRuby 0.9.1
-
Component/s: Java Integration
-
Labels:None
-
Environment:JRuby 0.9.0
-
Testcase included:yes
Description
Evaluate the following expression in JIRB:
Dir['.']
Under Ruby's IRB, this returns the following:
=> ["."]
Under JRuby 0.9.0's JIRB, the following happens:
irb(main):005:0> Dir['.']
NativeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
from java.lang.String.substring(String.java:1768)
from java.lang.String.substring(String.java:1735)
from org.jruby.util.Glob$GlobPattern.getMatchedFiles(Glob.java:308)
from org.jruby.util.Glob.getNames(Glob.java:198)
from org.jruby.RubyDir.glob(RubyDir.java:144)
from sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
from sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
from sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
from java.lang.reflect.Method.invoke(Method.java:585)
from org.jruby.runtime.callback.ReflectionCallback.execute(ReflectionCallback.java:140)
from org.jruby.internal.runtime.methods.CallbackMethod.internalCall(CallbackMethod.java:79)
from org.jruby.internal.runtime.methods.AbstractMethod.call(AbstractMethod.java:51)
from org.jruby.RubyObject.callMethod(RubyObject.java:362)
from org.jruby.RubyObject.callMethod(RubyObject.java:316)
from org.jruby.evaluator.EvaluateVisitor$CallNodeVisitor.execute(EvaluateVisitor.java:555)
from org.jruby.evaluator.EvaluationState.executeNext(EvaluationState.java:262)
... 318 levels...
from org.jruby.Main.runInterpreter(Main.java:176)
from org.jruby.Main.runInterpreter(Main.java:145)
from org.jruby.Main.run(Main.java:111)
from org.jruby.Main.main(Main.java:86)
from (irb):1
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:150:in `eval_input'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:70:in `signal_status'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:189:in `eval_input'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:70:in `each_top_level_statement'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:190:in `loop'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:190:in `catch'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:190:in `eval_input'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:70:in `start'
from C:\third-party\jruby-0.9.0\bin\jirb:13:in `catch'
from C:/third-party/jruby-0.9.0/lib/ruby/1.8/irb.rb:71:in `start'
from C:\third-party\jruby-0.9.0\bin\jirb:13irb(main)
Here's another non-conformity that could be related. In this example we're in a directory that has one subdirectory named 'abc'
Via Ruby:
Dir['./abc'] # => ["./abc"]
Via JRuby
Dir['./abc'] # => ["abc"]
Both responses are technically correct, but I wonder if perhaps there's some special handling of '.' that may be required within JRuby.