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

RMIConnector.addConnectionNotificationListener() throws IllegalArgumentException

    XMLWordPrintable

    Details

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

      Description



      Name: poR10007 Date: 10/24/2003



      The method RMIConnector.addConnectionNotificationListener(NotificationListener,
      NotificationFilter, Object) throws IllegalArgumentException instead of
      NullPointerException if the specified listener 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.remote.JMXServiceURL;
      import javax.management.remote.rmi.RMIConnector;

      public class Test {
          public static void main (String args[] ) {
              JMXServiceURL url = null;
              RMIConnector connector = null;
              try {
                  url = new JMXServiceURL("service:jmx:iiop://localhost:1234/jndi/jmxtest");
                  connector = new RMIConnector(url, null);
              } catch (Exception e) {
                  System.out.println("Exception during test setup");
      e.printStackTrace();
              }
      try {
      connector.addConnectionNotificationListener(null, null, null);
      } catch (NullPointerException e) {
      System.out.println("Ok");
              } catch (Exception e) {
      e.printStackTrace();
      }
          }
      }
      --------------------------------------------------------------------------------

      ---Execution log----------------------------------------------------------------
      $ jdk1.5.0-b25/solaris-sparc/bin/java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b25)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b25, mixed mode)
      $ jdk1.5.0-b25/solaris-sparc/bin/javac -d . Test.java
      $ jdk1.5.0-b25/solaris-sparc/bin/java Test
      java.lang.IllegalArgumentException: Listener can't be null
              at javax.management.NotificationBroadcasterSupport.addNotificationListener(NotificationBroadcasterSupport.java:83)
              at javax.management.remote.rmi.RMIConnector.addConnectionNotificationListener(RMIConnector.java:360)
              at Test.main(Test.java:16)
      $
      --------------------------------------------------------------------------------

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

        Attachments

          Activity

            People

            Assignee:
            dfuchs Daniel Fuchs
            Reporter:
            passunw Pas Pas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: