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

java.rmi.server.RMIClassLoader.loadClass specs are not clear

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description

      Name: avC70361 Date: 04/29/99



        java.rmi.server.RMIClassLoader.loadClass(URL, String) and loadClass(String, String) don't specify their
      behaviour in a case of null first argument. The reference implementation doesn't throw any exception as it
      might have been expected and loads a class with the standard class loader. But this behaviour is not evident
      and should be specified by the documnentation.

      Here is a test demonstrating the bug.
      ---------------RMILoaderTest.java----------------------
      import java.net.MalformedURLException;
      import java.net.URL;
      import java.rmi.RMISecurityManager;
      import java.rmi.server.RMIClassLoader;

      public class RMILoaderTest {

          public static void main(String[] args) {
              System.setSecurityManager(new RMISecurityManager());
              try {
                  Class cl = RMIClassLoader.loadClass((URL)null, "RMILoaderTest");
                  System.out.println("Failed. NullPointerException is not thrown");
              } catch(NullPointerException e) {
                  System.out.println("Passed.");
              } catch(MalformedURLException e) {
                  System.out.println("Failed. Unexpected exception : " + e);
              } catch(ClassNotFoundException e) {
                  System.out.println("Failed. Unexpected exception : " + e);
              }
          }

      }
      -----------------The test output-------
      > java RMILoaderTest
      Failed. NullPointerException is not thrown

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

        Attachments

          Activity

            People

            Assignee:
            peterjones Peter Jones
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: