6563318: RMI data sanitization

Reviewed-by: ahgross, hawtin, mchung, smarks
This commit is contained in:
Darryl Mocek 2012-11-19 13:54:12 -08:00
parent 7749e896e7
commit 52caa8646b
2 changed files with 42 additions and 3 deletions

View File

@ -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 @@ public final class CGIHandler {
returnServerError(e.getMessage());
}
else
returnClientError("invalid command: " + command);
returnClientError("invalid command.");
} catch (Exception e) {
returnServerError("internal error: " + e.getMessage());
}
@ -225,7 +225,7 @@ final class CGIForwardCommand implements CGICommandHandler {
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);

View File

@ -133,6 +133,14 @@ public class JavaVM {
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 @@ public class JavaVM {
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();
}
}
}
}