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

java.nio.charset.Charset.forName(name) return different reference value when requiring the same Charset.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Classlib
    • None

    Description

      java.nio.charset.Charset.forName(name) returns different reference value when requiring the same Charset.
      However, RI always returns the same reference for the same Charset, no matter using "alias" or "canonical" name as parameter.
      RI 5.0 passes the following test case, while Harmony fails.

      =============================== Test case ====================
      /*

      • test forName: invoke forName two times with the same canonical name,
      • it should return the same reference.
        */
        public void testForName_TwoSameRef1() { Charset cs1 = Charset.forName("UTF-8"); Charset cs2 = Charset.forName("UTF-8"); assertSame(cs1,cs2); }

      /*

      • test forName: invoke forName two times for the same Charset using canonical name and alias,
      • it should return the same reference.
        */
        public void testForName_TwoSameRef2() { Charset cs1 = Charset.forName("ASCII"); Charset cs2 = Charset.forName("US-ASCII"); assertSame(cs1,cs2); }

      Attachments

        1. Charset_patch_149.txt
          3 kB
          Richard Liang

        Activity

          People

            tellison Tim Ellison
            richard_liang Richard Liang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: