Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6847092

(cs) CharsetEncoder.isLegalReplacement of US_ASCII behaves differently since jdk7 b53

XMLWordPrintable

    • b64
    • generic
    • generic
    • Verified

      Here is a short code to reproduce,

      -------------Start of Code-------------
      gtee@bela: /net/sqenfs-1/export1/comp/jsn/users/evergreen/wzhu/testcodes $ cat Test_US_ASCII_IsLegalReplace.java
      import java.nio.charset.Charset;
      import java.nio.charset.CharsetEncoder;

      public class Test_US_ASCII_IsLegalReplace
      {
        public static void main (String[]args)
        {
          CharsetEncoder enc = Charset.forName("US-ASCII").newEncoder();
          byte[] newsubs = { 'A', 'S'};
          boolean result = enc.isLegalReplacement (newsubs);
          System.out.println("isLegalReplacement: " + result);
        }
      }
      -------------End of Code-------------


      gtee@bela: /net/sqenfs-1/export1/comp/jsn/users/evergreen/wzhu/testcodes $ /net/koori.sfbay/onestop/jdk/7/promoted/all/b52/binaries/linux-i586/bin/java Test_US_ASCII_IsLegalReplace
      isLegalReplacement: true
      gtee@bela: /net/sqenfs-1/export1/comp/jsn/users/evergreen/wzhu/testcodes $ /net/koori.sfbay/onestop/jdk/7/promoted/all/b53/binaries/linux-i586/bin/java Test_US_ASCII_IsLegalReplace
      isLegalReplacement: false

            sherman Xueming Shen
            tonyli Tony Li (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: