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

RMIConnector.getMBeanServerConnection() does not throw IOException

    XMLWordPrintable

    Details

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

      Description



      Name: poR10007 Date: 11/10/2003



      The method RMIConnector.getMBeanServerConnection() does not throw IOException
      when the connection to the remote MBean server has not yet been established.
      JMX Remote API spec for the method getMBeanServerConnection() reads:

       "Throws: IOException - if a valid MBeanServerConnection cannot be created,
       for instance because the connection to the remote MBean server has not yet
       been established (with the connect method), or it has been closed, or it
       has broken."

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

      ---Test.java--------------------------------------------------------------------
      import java.io.IOException;
      import javax.management.MBeanServerConnection;
      import javax.management.remote.JMXServiceURL;
      import javax.management.remote.rmi.RMIConnector;

      public class Test {
          public static void main(String[] args) {
              try {
                  final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
                  final RMIConnector client = new RMIConnector(url, null);

                  // IOException is expected
                  try {
                      final MBeanServerConnection connection =
                          client.getMBeanServerConnection();
                  } catch (IOException e) {
                      System.out.println("PASSED");
                      return;
                  }
              } catch (Exception e) {
                  System.out.println("FAILED: Unexpected exception caught: " + e);
                  return;
              }
              System.out.println("FAILED: Expected IOException is not thrown.");
              return;
          }
      }
      --------------------------------------------------------------------------------

      ---Execution log----------------------------------------------------------------
      $ jdk1.5.0-b26/solaris-sparc/bin/java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b26)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b26, mixed mode)
      $ jdk1.5.0-b26/solaris-sparc/bin/javac -d . ./Test.java
      $ jdk1.5.0-b26/solaris-sparc/bin/java Test
      FAILED: Expected IOException is not thrown.
      $
      --------------------------------------------------------------------------------

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

        Attachments

          Activity

            People

            Assignee:
            sjiang Shanliang Jiang (Inactive)
            Reporter:
            passunw Pas Pas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: