diff --git a/jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java b/jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java index 65adbdda7..23381d3f4 100644 --- a/jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java +++ b/jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java @@ -548,7 +548,7 @@ public class RegionMaker { return; } } - for (BlockNode node : block.getCleanSuccessors()) { + for (BlockNode node : block.getSuccessors()) { if (!visited.contains(node)) { traverseMonitorExits(region, arg, node, exits, visited); } diff --git a/jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatch8.java b/jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatch8.java new file mode 100644 index 000000000..ac96540a3 --- /dev/null +++ b/jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatch8.java @@ -0,0 +1,60 @@ +package jadx.tests.integration.trycatch; + +import jadx.core.dex.nodes.ClassNode; +import jadx.tests.api.IntegrationTest; + +import org.junit.Test; + +import static jadx.tests.api.utils.JadxMatchers.containsOne; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThat; + +public class TestTryCatch8 extends IntegrationTest { + + public static class TestCls { + static class MyException extends Exception { + private static final long serialVersionUID = 7963400419047287279L; + + MyException() { + } + + MyException(String msg, Throwable cause) { + super(msg, cause); + } + } + + MyException e = null; + + public void test() { + synchronized (this) { + try { + throw new MyException(); + } catch (MyException e) { + this.e = e; + } catch (Exception x) { + this.e = new MyException("MyExc", x); + } + } + } + + public void check() { + test(); + assertThat(e, notNullValue()); + assertThat(e, isA(MyException.class)); + assertThat(e.getMessage(), nullValue()); + } + } + + @Test + public void test() { + ClassNode cls = getClassNode(TestCls.class); + String code = cls.getCode().toString(); + + assertThat(code, containsOne("synchronized (this) {")); + assertThat(code, containsOne("throw new MyException();")); + assertThat(code, containsOne("} catch (MyException e) {")); + assertThat(code, containsOne("this.e = e;")); + assertThat(code, containsOne("} catch (Exception x) {")); + assertThat(code, containsOne("this.e = new MyException(\"MyExc\", x);")); + } +}