String#unpack with "@" pattern works incorrectly
------------------------------------------------

                 Key: JRUBY-1790
                 URL: http://jira.codehaus.org/browse/JRUBY-1790
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.x
         Environment: Latest JRuby 1.1b1 from trunk
            Reporter: Vladimir Sizikov
         Attachments: string-unpack-at.patch

Consider the following:

{noformat}
 "abc".unpack("@*")
{noformat}

This returns [] on MRI, but fails hard with JRuby:
Exception in thread "main" java.lang.IllegalArgumentException
        at java.nio.Buffer.position(Buffer.java:218)
        at org.jruby.util.Pack.unpack(Pack.java:652)
        at org.jruby.RubyString.unpack(RubyString.java:3454)


Also:
{noformat}
"abc".unpack("@10")
{noformat}

Throws ArgumentError in MRI, but throws internal JRuby exception in JRuby:

Exception in thread "main" java.lang.IllegalArgumentException
        at java.nio.Buffer.position(Buffer.java:218)
        at org.jruby.util.Pack.unpack(Pack.java:652)
        at org.jruby.RubyString.unpack(RubyString.java:3454)


This also leads to uncaught exception during Rubinius spec runs, which is 
really bad and needs to be fixed ASAP.

The provided patch (with regression tests) fixes the problem.

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