[1.9] Array#sample crashes with IAE ----------------------------------- Key: JRUBY-4321 URL: http://jira.codehaus.org/browse/JRUBY-4321 Project: JRuby Issue Type: Bug Components: Core Classes/Modules, Ruby 1.9 Affects Versions: JRuby 1.4 Environment: latest jruby Reporter: Vladimir Sizikov
{code} D:\work\jruby-dev\rubyspec.git>jruby --1.9 -e "p [:abc].sample(2)" Random.java:250:in `nextInt': java.lang.IllegalArgumentException: n must be positive from RubyArray.java:3320:in `sample' from org/jruby/RubyArray$i_method_multi$RUBYINVOKER$sample.gen:-1:in `call' from CachingCallSite.java:309:in `cacheAndCall' from CachingCallSite.java:148:in `call' from CallOneArgNode.java:57:in `interpret' from FCallOneArgNode.java:36:in `interpret' from NewlineNode.java:104:in `interpret' from RootNode.java:129:in `interpret' from Ruby.java:658:in `runInterpreter' from Ruby.java:554:in `runNormally' from Ruby.java:396:in `runFromMain' from Main.java:272:in `run' from Main.java:117:in `run' from Main.java:97:in `main' D:\work\jruby-dev\rubyspec.git>jruby --1.9 -e "p [:abc].sample(3)" Random.java:250:in `nextInt': java.lang.IllegalArgumentException: n must be positive from RubyArray.java:3325:in `sample' from org/jruby/RubyArray$i_method_multi$RUBYINVOKER$sample.gen:-1:in `call' from CachingCallSite.java:309:in `cacheAndCall' from CachingCallSite.java:148:in `call' from CallOneArgNode.java:57:in `interpret' from FCallOneArgNode.java:36:in `interpret' from NewlineNode.java:104:in `interpret' from RootNode.java:129:in `interpret' from Ruby.java:658:in `runInterpreter' from Ruby.java:554:in `runNormally' from Ruby.java:396:in `runFromMain' from Main.java:272:in `run' from Main.java:117:in `run' from Main.java:97:in `main' {code} -- 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