Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-4781

[test] To serialize the range type of jruby into yaml form, harmony generate different sequence from RI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Introduction:
      yaml for ruby is similar to xml for java. So it is very important for jruby.
      To serialize the range type of jruby into yaml form, harmony generate different sequence from RI
      Range is a data type in ruby, it has a begin, end and a excl element to different from each other.
      excl is true means it exclude the last data in the range.

      Issue Description:

      [1...3].to_yaml // get the range's yaml form

      1) Harmony will generate
      — !ruby/range
      end: 100000
      excl: true
      begin: 0

      2) RI will generate
      — !ruby/range
      begin: 0
      end: 100000
      excl: true

      They are not equal in jruby.

      Reason:
      Range using HashMap to record the begin,end and excl element.
      Their output order is the same in every Range, since their key value are always the same.
      But the order is different in Harmony.

      ===== RI =====
      Key= #<org.jvyamlb.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=begin)>, Hash= 562035919
      Key= #<org.jvyamlb.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=end)>, Hash= 541525921
      Key= #<org.jvyamlb.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=excl)>, Hash= 542781097

      =====Harmony =====
      Key= #<org.jvyamlb.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=end)>, Hash= 541525921
      Key= #<org.jvyamlb.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=excl)>, Hash= 542781097
      Key= #<org.jvyamlb.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=begin)>, Hash= 562035919

      Attachments

        Activity

          People

            Unassigned Unassigned
            qiuxiaox Sean Qiu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: