IO#foreach failures and crashes with rubyspecs
----------------------------------------------

                 Key: JRUBY-2073
                 URL: http://jira.codehaus.org/browse/JRUBY-2073
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
         Environment: Latest JRuby 1.1RC1
            Reporter: Vladimir Sizikov
            Assignee: Vladimir Sizikov
            Priority: Critical
             Fix For: JRuby 1.1RC2


IO#foreach in JRuby fails the following (newly added by me, hehe) rubyspecs:

IO::foreach
- yields a single string with entire content when the separator is an empty 
string
- can handle non-ASCII data as separator
- raises TypeError if the first parameter is nil
- treats second nil parameter as an empty string separator

The first spec even crashes JRuby:

{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
        at org.jruby.util.ByteList.get(ByteList.java:269)
        at org.jruby.RubyIO.getline(RubyIO.java:618)
        at org.jruby.RubyIO.foreach(RubyIO.java:2358)
        at org.jruby.RubyIOInvoker$foreach_method_1_1.call(Unknown Source)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:151)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:313)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:667)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:636)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:154)
        at org.jruby.runtime.InterpretedBlock.call(InterpretedBlock.java:107)
        at org.jruby.runtime.Block.call(Block.java:105)
        at org.jruby.RubyProc.call(RubyProc.java:201)
        at org.jruby.RubyProc.call(RubyProc.java:185)
        at org.jruby.RubyProcInvoker$call_method_0_0.call(Unknown Source)
{noformat}

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