提交 f81b55b2 编写于 作者: D dmocek

6563318: RMI data sanitization

Reviewed-by: ahgross, hawtin, mchung, smarks
上级 e26ca038
/*
* 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);
......
......@@ -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();
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册