mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-21 01:00:54 +08:00
parent
d17b459ecc
commit
1ca635fac6
@ -1483,7 +1483,7 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor {
|
||||
}
|
||||
if (!defaultHandlerOccurred) {
|
||||
writer.ws().append("else").ws().append("{").indent().softNewLine();
|
||||
writer.append("throw $$je;").softNewLine();
|
||||
writer.append("throw $$e;").softNewLine();
|
||||
writer.outdent().append("}").softNewLine();
|
||||
} else {
|
||||
writer.softNewLine();
|
||||
|
@ -18,6 +18,7 @@ package org.teavm.vm;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import java.util.function.Supplier;
|
||||
import org.junit.Test;
|
||||
@ -488,4 +489,21 @@ public class VMTest {
|
||||
interface ScriptExecutionWrapper {
|
||||
Object wrap(Supplier<Object> execution);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uncaughtExceptionRethrown() {
|
||||
boolean exceptionCaught = false;
|
||||
try {
|
||||
try {
|
||||
throw new NullPointerException("ok");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
fail("Should not get there");
|
||||
}
|
||||
fail("Should not get there");
|
||||
} catch (NullPointerException e) {
|
||||
assertEquals("ok", e.getMessage());
|
||||
exceptionCaught = true;
|
||||
}
|
||||
assertTrue("Exception was not caught", exceptionCaught);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user