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

class Character: 3 methods return invalid values

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic, x86
    • OS:
      generic, linux
    • Verification:
      Verified

      Description



      Name: ooR10006 Date: 03/19/2001


      Although the API spec for class java.lang.Character was correctly changed in jdk1.4.0beta-b56,
      (see 4404977) the following 3 methods return wrong results according to the changed spec:

      1. The spec for Character.isWhitespace(ch) says:
      "Determines if the specified character is white space according to Java. A character is
      a Java whitespace character if and only if it satisfies one of the following criteria:
         It is a Unicode space character (SPACE_SEPARATOR, LINE_SEPARATOR, or
         PARAGRAPH_SEPARATOR) but is not also a non-breaking space (\u00A0, \u2007, \u202F)..."

      However, method isWhitespace(char) returns true for 0x2007, 0x202F.
      the following test shows this:
       
      class Test {
          public static void main(String[] args){
              System.out.println(Character.isWhitespace((char)0x2007) + " " +
              Character.isWhitespace((char)0x202F));
              return;
          }
      }
      % jdk1.4.0beta-b56/solsparc/bin/java Test
      true true

      2. method getDirectionality(ch) returns value 0 for all undefined in UnicodeData characters
      instead of DIRECTIONALITY_UNDEFINED i.e. -1.
      The following example shows this:
      class Test {
          public static void main(String[] args){
              for (int i = 0; i < 0xFFFF; ++i){
                  if (!Character.isDefined((char)i)){
                      System.out.println(Character.getDirectionality((char)i));
                  }
              }
              return;
          }
      }

      The bug 4404977 which describes all the changes of Character spec has state 'integrated',
      the jdk1.4.0beta-b56 API spec is indeed changed, but the implementation doesn't conform
      to the spec.

      Due to this new Merlin JCK tests fail:
      api/java_lang/Character/index.html#getAttrFullRange[Character2086]
      api/java_lang/Character/index.html#attributesFullRange[Character2070]
      api/java_lang/Character/index.html#attributesFullRange[Character2079]
       
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: