Cloning java byte array returns incorrect object
------------------------------------------------

                 Key: JRUBY-3175
                 URL: http://jira.codehaus.org/browse/JRUBY-3175
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.1.5, JRuby 1.1.6
            Reporter: John Wells
            Priority: Minor


If you clone a byte array and try to convert it back into a ruby String, it 
breaks. See the example below:

irb(main):001:0> s = "switch me to bytes".to_java_bytes
=> #<#<Class:01x174f02c>:0x44006e @[EMAIL PROTECTED]>

irb(main):002:0> c = s.clone
=> #<#<Class:01x174f02c>:0x1852a81 @[EMAIL PROTECTED]>

irb(main):003:0> String.from_java_bytes s
=> "switch me to bytes"

irb(main):004:0> String.from_java_bytes c
TypeError: wrong argument type #<Class:01x174f02c> (expected byte[])
        from (irb):5
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:150:in `eval_input'
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:259:in `signal_status'
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:147:in `eval_input'
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:146:in `eval_input'
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:70:in `start'
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:69:in `catch'
        from /opt/jruby-1.1.5/lib/ruby/1.8/irb.rb:69:in `start'
        from /opt/jruby/bin/jirb:19
irb(main):005:0> 


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