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

Character.toTitleCase(c) returns incorrect values for undefined chars

XMLWordPrintable

    • beta2
    • generic, x86, sparc
    • generic, linux, solaris_8, windows_2000
    • Verified



      Name: ooR10006 Date: 05/03/2001


      Since jdk1.4.0beta-b59 Character.toTitleCase(c) returns incorrect values
      for undefined chars, total 7829 chars.

      The spec for toTitleCase(char) says:
      "Returns:
       the titlecase equivalent of the character, if any; otherwise, the character itself."

      According to this, undefined character itself should be returned, however for a char c
      toTitleCase(c) returns c+1.

      The following test shows the failure:

      public class Test {
          public static void main(String[] args){
              int[] c = {0x0220, 0x0221, 0x0234, 0x0235, 0x0236, 0x0237, 0x0238, 0x0239,
                  0x023a, 0x023b, 0x023c, 0x023d, 0x023e, 0x023f, 0x0240, 0x0241, 0x0242,
                  0x0243, 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b,
                  0x024c, 0x024d, 0x024e, 0x0659
              };
              String s = "";
              for(int i = 0; i < c.length; ++i){
                  s += " " + Integer.toHexString((int)Character.toTitleCase((char)c[i]));
              }
              System.out.println(s);
          }
      }

      % jdk1.4.0beta-b58/solsparc/bin/java Test
       220 221 234 235 236 237 238 239 23a 23b 23c 23d 23e 23f 240 241 242 243 244 245
       246 247 248 249 24a 24b 24c 24d 24e 659
      % jdk1.4.0beta-b59/solsparc/bin/java Test
       221 222 235 236 237 238 239 23a 23b 23c 23d 23e 23f 240 241 242 243 244 245 246
       247 248 249 24a 24b 24c 24d 24e 24f 65a
      %

      Due to this Merlin JCK test fails:
      api/java_lang/Character/index.html#caseFullRange[Character2083]

      jdk1.3.0fcsC passes the test

      ======================================================================

            joconnersunw John Oconner (Inactive)
            ovosunw Ovo Ovo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: