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

RemoteServer.setLog(null) throws NPE unexpectedly in 1.4

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • core-libs
    • sparc
    • solaris_2.6



      Name: acR10002 Date: 08/29/2002



      According to the J2SE API spec v1.4, the call RemoteServer.setLog(null)
      should just turn off the logging:
      ---
      public static void setLog(OutputStream out)

      Log RMI calls to the output stream out. If out is null, call logging is
      turned off.
      ---

      But, in fact, it throws NPE in JDK 1.4 b92 as it can be shown in the
      following example:

      -------- Test.java ---------
      import java.rmi.server.*;
      import java.rmi.activation.*;
      import java.io.*;

      public class Test {
          public static void main(String args[]) {
              RemoteServer.setLog(null);
          }
      }
      ----------------------------

      Output:

      ----------------------------
      ->java -version
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      ->java Test
      Exception in thread "main" java.lang.NullPointerException
              at java.util.logging.Logger.removeHandler(Logger.java:1150)
              at sun.rmi.runtime.Log$LoggerLog.setOutputStream(Log.java:242)
              at java.rmi.server.RemoteServer.setLog(RemoteServer.java:72)
              at Test.main(Test.java:9)
      ----------------------------

      I've found that the NPE is no longer thrown in JDK 1.4.1.

      So if this has been already fixed as another BugID, please feel free to
      close this one as a duplicate of such.
      This can also be marked as fixed/int in hopper if this is appropriate.

      The bug is needed to track JCK 1.4a test failures under JDK 1.4.

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

            Unassigned Unassigned
            aycsunw Ayc Ayc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: