Named captures cause crash when there is no match
-------------------------------------------------

                 Key: JRUBY-5863
                 URL: http://jira.codehaus.org/browse/JRUBY-5863
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules, Ruby 1.9.2
    Affects Versions: JRuby 1.6.1
         Environment: Arch Linux, x86_64, 2.6.38
            Reporter: Gabor Szarka


The below snippet explains everything.

[gabor@gabor-desktop-arch ~]$ rvm use jruby
Using /home/gabor/.rvm/gems/jruby-1.6.1
[gabor@gabor-desktop-arch ~]$ rvm --version

rvm 1.6.13 by Wayne E. Seguin (wayneeseg...@gmail.com) 
[https://rvm.beginrescueend.com/]

[gabor@gabor-desktop-arch ~]$ jruby -v
jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (OpenJDK 64-Bit Server VM 
1.6.0_22) [linux-amd64-java]
[gabor@gabor-desktop-arch ~]$ ruby
/(?<a>.+)/ =~ ""
RuntimeHelpers.java:2241:in `updateScopeWithCaptures': 
java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to 
org.jruby.RubyMatchData
        from RuntimeHelpers.java:2228:in `match2AndUpdateScope'
        from -:1:in `__file__'
        from -:-1:in `load'
        from Ruby.java:671:in `runScript'
        from Ruby.java:575:in `runNormally'
        from Ruby.java:424:in `runFromMain'
        from Main.java:278:in `doRunFromMain'
        from Main.java:198:in `internalRun'
        from Main.java:164:in `run'
        from Main.java:148:in `run'
        from Main.java:128:in `main'
[gabor@gabor-desktop-arch ~]$ irb
jruby-1.6.1 :001 > /(?<a>.+)/ =~ ""
 => nil 
jruby-1.6.1 :002 > exit

--
This message is automatically generated by JIRA.
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