Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dir['{}'] crashes with java.lang.ArrayIndexOutOfBoundsException: 0 #2922

Closed
mjc opened this issue May 8, 2015 · 4 comments
Closed

Dir['{}'] crashes with java.lang.ArrayIndexOutOfBoundsException: 0 #2922

mjc opened this issue May 8, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@mjc
Copy link
Contributor

@mjc mjc commented May 8, 2015

Repro: https://github.com/mjc/dotenv-jruby1720

Trace: https://gist.github.com/mjc/24fa1402bf4571c7c8cb

Removing either spring or dotenv-rails makes it go away.

@kares
Copy link
Member

@kares kares commented May 11, 2015

without trying it out ... do you happen to know if this was present in 1.7.19 ?

@mjc
Copy link
Contributor Author

@mjc mjc commented May 12, 2015

@kares yes, I discovered it in 1.7.19 initially.

@kares kares self-assigned this May 13, 2015
@kares
Copy link
Member

@kares kares commented May 13, 2015

can confirm it's a Dir[] thing when '{}' is passed ... work-around on its way

jruby-1.7.19 :004 > Dir['{}']
Java::JavaLang::ArrayIndexOutOfBoundsException: 0
    from org.jruby.util.Dir.isAbsolutePath(Dir.java:550)
    from org.jruby.util.Dir.glob_helper(Dir.java:649)
    from org.jruby.util.Dir.push_globs(Dir.java:466)
    from org.jruby.util.Dir.push_braces(Dir.java:439)
    from org.jruby.util.Dir.push_braces(Dir.java:457)
    from org.jruby.util.Dir.push_glob(Dir.java:303)
    from org.jruby.RubyDir.aref(RubyDir.java:206)
    from org.jruby.RubyDir$INVOKER$s$0$0$aref.call(RubyDir$INVOKER$s$0$0$aref.gen)
    from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:665)
    from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:206)
    from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
    from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
    from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    from org.jruby.ast.RootNode.interpret(RootNode.java:129)
    from org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:95)
... 121 levels...
@kares kares changed the title JRuby 1.7.x crashes with java.lang.ArrayIndexOutOfBoundsException: 0 when booting rails with spring and dotenv-rails loaded Dir['{}'] crashes with java.lang.ArrayIndexOutOfBoundsException: 0 May 13, 2015
kares added a commit to kares/jruby that referenced this issue May 13, 2015
)

... in this case we end up with an empty path in Dir's `glob_helper` and it all seems reasonable - thuse removed the length check comment about "" ending up here
@kares kares added this to the JRuby 1.7.21 milestone May 13, 2015
@kares
Copy link
Member

@kares kares commented May 15, 2015

resolved on jruby-1_7 with 0da8bff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.