Array#select! leads to exception: NoMethodError: undefined method `<=' for 
nil:NilClass
---------------------------------------------------------------------------------------

                 Key: JRUBY-5574
                 URL: http://jira.codehaus.org/browse/JRUBY-5574
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6RC3
         Environment: jruby-1.6.0.RC3 in 1.9.2 mode

Ubuntu 10.04 LTS 

2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC 2011 i686 GNU/Linux 

java version "1.6.0_20" 
OpenJDK Runtime Environment (IcedTea6 1.9.5) (6b20-1.9.5-0ubuntu1~10.04.1) 
OpenJDK Server VM (build 19.0-b09, mixed mode)
            Reporter: Robert Pankowecki
            Assignee: Thomas E Enebo


IS:

def foo
 result = [1,2,3,4,5,6,5,4,3,2,1]
 result.select!{|x| x <= 5}
 result.select!{|x| x <= 3}
 result.select!{|x| x >= 2}
 result
end

foo
NoMethodError: undefined method `<=' for nil:NilClass
        from org/jruby/RubyBasicObject.java:1654:in `method_missing'
        from 
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/activesupport-3.0.5/lib/active_support/whiny_nil.rb:48:in
 `method_missing'
        from (irb):17:in `foo'
        from org/jruby/RubyArray.java:2387:in `select!'
        from (irb):17:in `foo'
        from (irb):21:in `evaluate'
        from org/jruby/RubyKernel.java:1092:in `eval'
        from org/jruby/RubyKernel.java:1417:in `loop'
        from org/jruby/RubyKernel.java:1204:in `catch'
        from org/jruby/RubyKernel.java:1204:in `catch'
        from 
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in
 `start'
        from 
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in
 `start'
        from 
/home/rupert/.rvm/gems/jruby-1.6.0.RC3/gems/railties-3.0.5/lib/rails/commands.rb:23:in
 `(root)'
        from org/jruby/RubyKernel.java:1046:in `require'
        from script/rails:6:in `(root)'
jruby-1.6.0.RC3 :022 > 

MRI:

ruby-1.9.2-p136 :001 > def foo
ruby-1.9.2-p136 :002?>    result = [1,2,3,4,5,6,5,4,3,2,1]
ruby-1.9.2-p136 :003?>    result.select!{|x| x <= 5}
ruby-1.9.2-p136 :004?>    result.select!{|x| x <= 3}
ruby-1.9.2-p136 :005?>    result.select!{|x| x >= 2}
ruby-1.9.2-p136 :006?>    result
ruby-1.9.2-p136 :007?>   end
nil
ruby-1.9.2-p136 :008 > foo
[
    [0] 2,
    [1] 3,
    [2] 3,
    [3] 2
]


-- 
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