--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,8 +26,8 @@
* @summary rmid and rmiregistry could allow alternate security manager
* @author Laird Dornin
*
- * @library ../../testlibrary
- * @build StreamPipe TestParams TestLibrary JavaVM
+ * @library ../../testlibrary
+ * @build StreamPipe TestParams TestLibrary JavaVM
* @build AltSecurityManager TestSecurityManager
* @run main/othervm AltSecurityManager
*/
@@ -38,7 +38,7 @@
* that throws a runtime exception in its checkListen method, this
* will cause rmiregistry and rmid to exit early because those
* utilities will be unable to export any remote objects; test fails
- * if registry and rmid take too long to exit.
+ * if registry and rmid take too long to exit.
*/
public class AltSecurityManager implements Runnable {
@@ -54,74 +54,74 @@
static long TIME_OUT = 15000;
public void run() {
- try {
- vm = new JavaVM(utilityToStart,
- " -Djava.security.manager=TestSecurityManager",
- "");
- System.err.println("starting " + utilityToStart);
- vm.start();
- vm.getVM().waitFor();
+ try {
+ vm = new JavaVM(utilityToStart,
+ " -Djava.security.manager=TestSecurityManager",
+ "");
+ System.err.println("starting " + utilityToStart);
+ vm.start();
+ vm.getVM().waitFor();
- } catch (Exception e) {
- TestLibrary.bomb(e);
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ }
}
-
+
/**
* Wait to make sure that the registry and rmid exit after
* their security manager is set.
*/
public static void ensureExit(String utility) throws Exception {
- utilityToStart = utility;
-
- try {
- Thread thread = new Thread(new AltSecurityManager());
- System.err.println("expecting RuntimeException for " +
- "checkListen in child process");
- long start = System.currentTimeMillis();
- thread.start();
- thread.join(TIME_OUT);
-
- long time = System.currentTimeMillis() - start;
- System.err.println("waited " + time + " millis for " +
- utilityToStart + " to die");
+ utilityToStart = utility;
- if (time >= TIME_OUT) {
-
- // dont pollute other tests; increase the likelihood
+ try {
+ Thread thread = new Thread(new AltSecurityManager());
+ System.err.println("expecting RuntimeException for " +
+ "checkListen in child process");
+ long start = System.currentTimeMillis();
+ thread.start();
+ thread.join(TIME_OUT);
+
+ long time = System.currentTimeMillis() - start;
+ System.err.println("waited " + time + " millis for " +
+ utilityToStart + " to die");
+
+ if (time >= TIME_OUT) {
+
+ // dont pollute other tests; increase the likelihood
// that rmid will go away if it did not exit already.
- if (utility.equals(rmid)) {
- RMID.shutdown();
- }
-
- TestLibrary.bomb(utilityToStart +
- " took too long to die...");
- } else {
- System.err.println(utilityToStart +
- " terminated on time");
- }
- } finally {
- vm.destroy();
- vm = null;
- }
+ if (utility.equals(rmid)) {
+ RMID.shutdown();
+ }
+
+ TestLibrary.bomb(utilityToStart +
+ " took too long to die...");
+ } else {
+ System.err.println(utilityToStart +
+ " terminated on time");
+ }
+ } finally {
+ vm.destroy();
+ vm = null;
+ }
}
-
+
public static void main(String[] args) {
- try {
- System.err.println("\nRegression test for bug 4183202\n");
+ try {
+ System.err.println("\nRegression test for bug 4183202\n");
- // make sure the registry exits early.
- ensureExit(registry);
+ // make sure the registry exits early.
+ ensureExit(registry);
- // make sure rmid exits early
- ensureExit(rmid);
+ // make sure rmid exits early
+ ensureExit(rmid);
- System.err.println("test passed");
+ System.err.println("test passed");
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- RMID.removeLog();
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ RMID.removeLog();
+ }
}
}