fix yet another AIOOBE caused by finally dfa

This commit is contained in:
peter
2013-10-01 13:16:18 +02:00
parent 3a1ab0f858
commit 0378563657
3 changed files with 33 additions and 0 deletions
@@ -714,6 +714,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
if (cd.isFinally()) {
flushVariablesInsideTry(cd);
addInstruction(new GosubInstruction(cd.getJumpOffset(this)));
break;
}
else if (cd.getType().isAssignableFrom(exceptionClass)) { // Definite catch.
flushVariablesInsideTry(cd);
@@ -0,0 +1,31 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class Foo {
private void run(int port) throws Exception {
Socket socket = new Socket("localhost", port);
try {
InputStream inputReader = socket.getInputStream();
try {
OutputStream outputWriter = socket.getOutputStream();
try {
while (true) {
inputReader.read();
}
}
finally {
outputWriter.close();
}
}
finally {
inputReader.close();
}
}
finally {
socket.close();
}
}
}
@@ -69,6 +69,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testTryCatchInForNotComplex() throws Throwable { doTest(); }
public void testNestedTryInWhileNotComplex() throws Throwable { doTest(); }
public void testExceptionFromFinally() throws Throwable { doTest(); }
public void testExceptionFromFinallyNesting() throws Throwable { doTest(); }
public void testFieldChangedBetweenSynchronizedBlocks() throws Throwable { doTest(); }
public void testGeneratedEquals() throws Throwable { doTest(); }