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

Character.getNumericValue(c) returns 0 for undefined chars

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: ooR10006 Date: 05/03/2001


      Since jdk1.4.0beta-b59 Character.getNumericValue(c) returns 0
      instead of -1 for undefined chars.

      The spec for getNumericValue(char) says:
      "Returns:
       the numeric value of the character, as a nonnegative int value; -2 if the character
       has a numeric value that is not a nonnegative integer; -1 if the character has no
       numeric value."

      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
              };
              String s = "";
              for(int i = 0; i < c.length; ++i){
                  s += " " + Character.getNumericValue((char)c[i]);
              }
              System.out.println(s);
          }
      }

      % jdk1.4.0beta-b58/solsparc/bin/java Test
       -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
      % jdk1.4.0beta-b59/solsparc/bin/java Test
       0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
      %

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

      jdk1.3.0fcsC passes the test

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

        Attachments

          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: