Harmony
  1. Harmony
  2. HARMONY-113

java.nio.charset.Charset should regard empty charset name properly as Illegal CharsetName

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None

      Description

      I think it's caused by the different between RI 1.4.2 and RI 5.0. Three test cases in JIRA#57 should be updated accordingly.

      public void testIsSupported_EmptyString() {
      try

      { Charset.isSupported(""); fail("Should throw IllegalCharsetNameException!"); }

      catch (IllegalCharsetNameException e)

      { // }
      }

      public void testConstructor_EmptyCanonicalName() {
      try { new MockCharset("", new String[0]); fail("Should throw IllegalCharsetNameException!"); } catch (IllegalCharsetNameException e) { // }

      }

      public void testConstructor_EmptyAliases() {
      try {
      new MockCharset("mockChar", new String[]

      { "" }

      );
      fail("Should throw IllegalCharsetNameException!");
      } catch (IllegalCharsetNameException e)

      { // }

      }

      1. charset_patch.txt
        8 kB
        Richard Liang

        Activity

        Hide
        Richard Liang added a comment -

        Please try my patch. Thanks a lot.

        Show
        Richard Liang added a comment - Please try my patch. Thanks a lot.
        Hide
        Richard Liang added a comment -

        I'v forgotten to say the test cases above pass on RI 5.0

        Show
        Richard Liang added a comment - I'v forgotten to say the test cases above pass on RI 5.0
        Hide
        Tim Ellison added a comment -

        Richard,

        The tests you provide above are dependent upon the HARMONY-57 code being incorporated into the project.

        Would you like to submit stand-alone test cases? or if you prefer I can mark this fix as dependent upon HARMONY-57.

        Regards,
        Tim

        Show
        Tim Ellison added a comment - Richard, The tests you provide above are dependent upon the HARMONY-57 code being incorporated into the project. Would you like to submit stand-alone test cases? or if you prefer I can mark this fix as dependent upon HARMONY-57 . Regards, Tim
        Hide
        Richard Liang added a comment -

        Yes, Tim.
        I think you can fix this issue. I will verify your update after you mark this issue as fixed. When JIRA57 is acceptted I will create patch for the test cases, otherwise there may be duplication.
        Thanks a lot.

        Show
        Richard Liang added a comment - Yes, Tim. I think you can fix this issue. I will verify your update after you mark this issue as fixed. When JIRA57 is acceptted I will create patch for the test cases, otherwise there may be duplication. Thanks a lot.
        Hide
        Tim Ellison added a comment -

        Richard,

        Thanks for the patch, which looks ok.

        Applied in NIO_CHAR module java.nio.Charset at repo revision 380635.
        I have only used a subset of the tests that you provided, since there is no definition for MockCharset.

        Please check that the patch was applied as you expected.

        Show
        Tim Ellison added a comment - Richard, Thanks for the patch, which looks ok. Applied in NIO_CHAR module java.nio.Charset at repo revision 380635. I have only used a subset of the tests that you provided, since there is no definition for MockCharset. Please check that the patch was applied as you expected.
        Hide
        Richard Liang added a comment -

        Yes, Tim. The patch looks good.

        Show
        Richard Liang added a comment - Yes, Tim. The patch looks good.
        Hide
        Tim Ellison added a comment -

        Verified by Richard

        Show
        Tim Ellison added a comment - Verified by Richard

          People

          • Assignee:
            Tim Ellison
            Reporter:
            Richard Liang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development