[jira] Created: (JRUBY-4215) YAML: MRI does not load JRuby yaml files correctly (Problem is hash-key that start with zero)

View: New views
1 Messages — Rating Filter:   Alert me  

[jira] Created: (JRUBY-4215) YAML: MRI does not load JRuby yaml files correctly (Problem is hash-key that start with zero)

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

YAML: MRI does not load JRuby yaml files correctly (Problem is hash-key that start with zero)
---------------------------------------------------------------------------------------------

                 Key: JRUBY-4215
                 URL: http://jira.codehaus.org/browse/JRUBY-4215
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.4
         Environment: Snow Leopard
            Reporter: Thies C. Arntzen


in jirb:

>> {"0:1" => "0:1", "1:1" => "1:1"}.to_yaml
=> "--- \n\"1:1\": \"1:1\"\n0:1: 0:1\n"
>> YAML.load "--- \n\"1:1\": \"1:1\"\n0:1: 0:1\n"
=> {"0:1"=>"0:1", "1:1"=>"1:1"}

all is fine - see that the key 0:1 is not qouted in the generated YAML

if I try to load the jruby generated YAML in mri (ree 1.8.7) I don't get the 0:1 key back but instead just a 1:

>> YAML.load "--- \n\"1:1\": \"1:1\"\n0:1: 0:1\n"
=> {1=>1, "1:1"=>"1:1"}

If I serialize the original hash in mri mri will also quote the 0:1 hash index so it will load the YAML back correctly.

>> {"0:1" => "0:1", "1:1" => "1:1"}.to_yaml
=> "--- \n\"0:1\": \"0:1\"\n\"1:1\": \"1:1\"\n"
>> YAML.load "--- \n\"0:1\": \"0:1\"\n\"1:1\": \"1:1\"\n"
=> {"0:1"=>"0:1", "1:1"=>"1:1"}

I'm not sure if this is a bug in the mri ruby implementation or in jruby!








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