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

unexpected NullPointerException for Arrays.deepToString(Object[] a)

XMLWordPrintable

    • b40
    • generic
    • generic
    • Verified



      Name: viR10068 Date: 01/14/2004


      The API spec for java.util.Arrays.deepToString(Object[] a):
      'This method returns "null" if the specified array is null.'

      But the jdk1.5.0-b33 throws the unexpected NullPointerException.

      The new JCK test is failed due to this bug:
      api/java_util/Arrays/index.html#deepToStringObjectArr[deepToStringOA0003]

      The source:
      ------------------ B.java -------------------
      import java.io.PrintStream;

      public class B {
          public static void main(String args[]) {
              System.out.println("The result is " + java.util.Arrays.deepToString(null));
          }
      }
      ------------------------------------------------

      The output:
      % jdk1.5.0-b33/solaris-sparc/bin/javac -source 1.5 -target 1.5 B.java &&
      jdk1.5.0-b33/solaris-sparc/bin/java -Xfuture -showversion B
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b33)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b33, mixed mode)

      Exception in thread "main" java.lang.NullPointerException
              at java.util.Arrays.deepToString(Arrays.java:3113)
              at B.main(B.java:5)
      %

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

            jjb Josh Bloch
            vivsunw Viv Viv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: