test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 28,38 **** * java.rmi.server.codebase property, not the list of "file:" URLs for the * actual elements of the CLASSPATH. * @author Peter Jones * * @library ../../testlibrary ! * @build ClassPathCodebase Dummy * @run main/othervm/policy=security.policy ClassPathCodebase */ import java.io.*; import java.net.*; --- 28,38 ---- * java.rmi.server.codebase property, not the list of "file:" URLs for the * actual elements of the CLASSPATH. * @author Peter Jones * * @library ../../testlibrary ! * @build ClassPathCodebase Dummy TestLibrary * @run main/othervm/policy=security.policy ClassPathCodebase */ import java.io.*; import java.net.*;
*** 81,95 **** String rmiregistryCommand = System.getProperty("java.home") + File.separator + "bin" + File.separator + "rmiregistry"; String cmdarray[] = new String[] { rmiregistryCommand, "-J-Denv.class.path=.", "-J-Djava.rmi.server.codebase=" + exportCodebaseURL, ! Integer.toString(TestLibrary.REGISTRY_PORT) }; System.err.println("\nCommand used to spawn rmiregistry process:"); System.err.println("\t" + Arrays.asList(cmdarray).toString()); rmiregistry = Runtime.getRuntime().exec(cmdarray, null, rmiregistryDir); --- 81,96 ---- String rmiregistryCommand = System.getProperty("java.home") + File.separator + "bin" + File.separator + "rmiregistry"; + int port = TestLibrary.getUnusedRandomPort(); String cmdarray[] = new String[] { rmiregistryCommand, "-J-Denv.class.path=.", "-J-Djava.rmi.server.codebase=" + exportCodebaseURL, ! Integer.toString(port) }; System.err.println("\nCommand used to spawn rmiregistry process:"); System.err.println("\t" + Arrays.asList(cmdarray).toString()); rmiregistry = Runtime.getRuntime().exec(cmdarray, null, rmiregistryDir);
*** 116,126 **** /* * Find the registry that we created and bind the * dummy object to it. */ Registry registry = LocateRegistry.getRegistry( ! "localhost", TestLibrary.REGISTRY_PORT); try { registry.bind(dummyBinding, dummyObject); System.err.println("Bound dummy object in registry"); } catch (java.rmi.ConnectException e) { --- 117,127 ---- /* * Find the registry that we created and bind the * dummy object to it. */ Registry registry = LocateRegistry.getRegistry( ! "localhost", port); try { registry.bind(dummyBinding, dummyObject); System.err.println("Bound dummy object in registry"); } catch (java.rmi.ConnectException e) {
*** 131,141 **** ((UnmarshalException) e.detail).detail instanceof ClassNotFoundException) { System.err.println( "Error: another registry running on port " + ! TestLibrary.REGISTRY_PORT + "?"); } throw e; } /* --- 132,142 ---- ((UnmarshalException) e.detail).detail instanceof ClassNotFoundException) { System.err.println( "Error: another registry running on port " + ! port + "?"); } throw e; } /*