[classlib] [luni] System.exec() gets interruption will cause InternalError
--------------------------------------------------------------------------
Key: HARMONY-6004
URL: https://issues.apache.org/jira/browse/HARMONY-6004
Project: Harmony
Issue Type: Bug
Components: Classlib
Affects Versions: 5.0M7
Reporter: Kevin Zhou
Fix For: 5.0M8
Conduct a test case [1] on HY5 and RI.
Modify the final part of Support_Exec from [2] to [3].
RI works well while HY5 throws InternalError.
[1]. SystemProcessTest
public void test_interrupt() throws Exception {
Object[] execArgs = null;
Process process = null;
try {
Thread.currentThread().interrupt();
execArgs = Support_Exec.execJava2(
new String[] { "tests.support.Support_AvailTest" }, null,
true);
process = (Process) execArgs[0];
OutputStream os = process.getOutputStream();
os.write("10 5 abcde".getBytes());
os.close();
process.waitFor();
fail("Should throw InterruptedException");
} catch (InterruptedException e) {
// Expected
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignored
}
process.waitFor();
Support_Exec.checkStderr(execArgs);
process.destroy();
}
[2].
synchronized (proc) {
errThread.start();
// wait for errThread to start
proc.wait();
[3].
synchronized (proc) {
errThread.start();
// wait for errThread to start
int count = 0;
boolean isFinished = false;
while(!isFinished) {
try {
proc.wait();
isFinished = true;
} catch (InterruptedException e) {
if(++count == 2) {
throw e;
}
}
}
if(count > 0) {
Thread.currentThread().interrupt();
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|