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

IllegalArgumentException not thrown for invalid protocol provider classloader

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.0
    • 1.0
    • core-svc
    • None
    • 1.0
    • sparc
    • solaris_2.5.1

        The javadoc for JMXConnectorFactory and JMXConnectorServerFactory says:

        "If the environment parameter to newJMXConnector(Server) contains the key
        jmx.remote.protocol.provider.class.loader then the associated value is the
        class loader to use to load the provider. If the associated value is not an
        instance of ClassLoader, an IllegalArgumentException is thrown."

        But IllegalArgumentException is never thrown when the value of the
        property is not an instance of ClassLoader.

        Server side:

            // Create environment map
            //
            final HashMap env = new HashMap(1);
            env.put(JMXConnectorServerFactory.PROTOCOL_PROVIDER_CLASS_LOADER, "dummy");

            // Create a JMXConnectorServer
            //
            try {
                JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
                errorCount++;
            } catch (IllegalArgumentException e) {
                status = Status.passed("Got expected IllegalArgumentException");
            }

        Client side:

            // Create environment map
            //
            final HashMap env = new HashMap(1);
            env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_CLASS_LOADER, "dummy");

            // Create a JMXConnector
            //
            try {
                JMXConnectorFactory.newJMXConnector(server.getAddress(), env);
                errorCount++;
            } catch (IllegalArgumentException e) {
                status = Status.passed("Got expected IllegalArgumentException");
            }

              emcmanus Eamonn McManus
              lmalvent Luis-Miguel Alventosa (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: