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

RMIConnectorServer.setMBeanServerForwarder() throws NPE instead of IAE

XMLWordPrintable

    • b30
    • generic
    • generic
    • Verified



      Name: skR10005 Date: 10/28/2003



      The method RMIConnectorServer.setMBeanServerForwarder(MBeanServerForwarder mbsf)
      throws NullPointerException instead of IllegalArgumentException
      if the specified mbsf is null.

      The API specification of the method JMXConnectorServerMBean.setMBeanServerForwarder reads:
        "IllegalArgumentException - if the call to mbsf.setMBeanServer fails with
         IllegalArgumentException. This includes the case where mbsf is null."

      The following test fails running on JDK 1.5.0-beta-b25.
      See below the test source and the execution log:

      ---test.java--------------------------------------------------------------------
      import javax.management.*;
      import javax.management.remote.*;
      import javax.management.remote.rmi.*;

      public class test {
          public static void main(String[] argv) {
              RMIConnectorServer rcs = null;
              try {
                  MBeanServer mbs = MBeanServerFactory.newMBeanServer();
                  JMXServiceURL url = new JMXServiceURL("service:jmx:iiop://localhost:0/jndi/iiop://@iiop-host@:@iiop-port@/aname");
                  rcs = new RMIConnectorServer(url, null, mbs);
              } catch (Throwable thr) {
                  System.out.println(thr.toString());
              }
              try {
                  if(rcs != null) {
                      rcs.setMBeanServerForwarder(null);
                  }
              } catch (Throwable thr) {
                  System.out.println("setMBeanServerForwarder:" + thr.toString());
              }
          }
      }
      --------------------------------------------------------------------------------

      ---Execution log----------------------------------------------------------------
      $ java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b25)
      Java HotSpot(TM) Server VM (build 1.5.0-beta-b25, mixed mode)
      $ javac -d . test.java
      $ java -cp . test
      setMBeanServerForwarder:java.lang.NullPointerException
      $
      --------------------------------------------------------------------------------

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

            dfuchs Daniel Fuchs
            serjsunw Serj Serj (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: