--- a/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java Fri Nov 16 11:05:43 2012 +0400
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java Mon Nov 19 13:54:12 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -153,7 +153,7 @@
returnServerError(e.getMessage());
}
else
- returnClientError("invalid command: " + command);
+ returnClientError("invalid command.");
} catch (Exception e) {
returnServerError("internal error: " + e.getMessage());
}
@@ -225,7 +225,7 @@
try {
port = Integer.parseInt(param);
} catch (NumberFormatException e) {
- throw new CGIClientException("invalid port number: " + param);
+ throw new CGIClientException("invalid port number.");
}
if (port <= 0 || port > 0xFFFF)
throw new CGIClientException("invalid port: " + port);
--- a/jdk/test/java/rmi/testlibrary/JavaVM.java Fri Nov 16 11:05:43 2012 +0400
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java Mon Nov 19 13:54:12 2012 -0800
@@ -133,6 +133,14 @@
return TestLibrary.getExtraProperty("jcov.options","");
}
+ public void start(Runnable runnable) throws IOException {
+ if (runnable == null) {
+ throw new NullPointerException("Runnable cannot be null.");
+ }
+
+ start();
+ new JavaVMCallbackHandler(runnable).start();
+ }
/**
* Exec the VM as specified in this object's constructor.
@@ -235,4 +243,35 @@
protected Process getVM() {
return vm;
}
+
+ /**
+ * Handles calling the callback.
+ */
+ private class JavaVMCallbackHandler extends Thread {
+ Runnable runnable;
+
+ JavaVMCallbackHandler(Runnable runnable) {
+ this.runnable = runnable;
+ }
+
+
+ /**
+ * Wait for the Process to terminate and notify the callback.
+ */
+ @Override
+ public void run() {
+ if (vm != null) {
+ try {
+ vm.waitFor();
+ } catch(InterruptedException ie) {
+ // Restore the interrupted status
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ if (runnable != null) {
+ runnable.run();
+ }
+ }
+ }
}