Enumerable#grep blows up on an array when passed a regexp
---------------------------------------------------------

                 Key: JRUBY-2233
                 URL: http://jira.codehaus.org/browse/JRUBY-2233
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
            Reporter: Charles Oliver Nutter
             Fix For: JRuby 1.1RC3


Because Array#each only gets a backtrace frame, self is null; when the regexp 
wants to set backref, it can't get at a runtime because self is null:

{noformat}
['1'].grep(/1/)
Exception in thread "main" java.lang.NullPointerException
        at org.jruby.runtime.Frame.getBackRef(Frame.java:161)
        at org.jruby.RubyRegexp.updateBackRef(RubyRegexp.java:542)
        at org.jruby.RubyRegexp.search(RubyRegexp.java:536)
        at org.jruby.RubyRegexp.eqq(RubyRegexp.java:259)
        at org.jruby.RubyRegexpDispatcher_for_Regexp.callMethod(Unknown Source)
        at org.jruby.RubyClass.invoke(RubyClass.java:223)
        at 
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:330)
        at org.jruby.RubyObject.callMethod(RubyObject.java:481)
        at org.jruby.RubyEnumerable$5.call(RubyEnumerable.java:161)
        at org.jruby.runtime.CallBlock.yield(CallBlock.java:90)
        at org.jruby.runtime.CallBlock.yield(CallBlock.java:69)
        at org.jruby.runtime.Block.yield(Block.java:109)
        at org.jruby.RubyArray.each(RubyArray.java:1184)
        at org.jruby.RubyArrayInvoker$each_method_0_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:101)
        at org.jruby.RubyClass.invoke(RubyClass.java:237)
        at 
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:314)
        at org.jruby.RubyObject.callMethod(RubyObject.java:475)
        at org.jruby.RubyEnumerable.callEach(RubyEnumerable.java:60)
        at org.jruby.RubyEnumerable.grep(RubyEnumerable.java:159)
        at org.jruby.RubyEnumerableInvoker$grep_method_1_0.call(Unknown Source)
{noformat}

Fix 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