From cb086955c2a21270cd2f53a8bce71e577d776506 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 2 Nov 2015 16:20:00 -0800 Subject: ART: Change behavior for rethrowing init failures (2) Always store the pending exception when making a class erroneous. Instead of filtering by ExceptionInInitializerError, add an option to the rethrow that enforces a NoClassDefFoundError, which is required by the specification. Use the libcore companion change to add the stored error (if any) as a cause to the NoClassDefFoundError, which should significantly help tracking down issues. Fix run-test 008 to expect spec-compliant behavior. Test that a cause has been set. Bug: 25445103 Change-Id: I6a0dc54e78312283faf23415887eff387531407f --- test/008-exceptions/src/Main.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/008-exceptions/src/Main.java') diff --git a/test/008-exceptions/src/Main.java b/test/008-exceptions/src/Main.java index c0502047d0..9e3477a47b 100644 --- a/test/008-exceptions/src/Main.java +++ b/test/008-exceptions/src/Main.java @@ -98,8 +98,9 @@ public class Main { try { BadInit.dummy = 1; throw new IllegalStateException("Should not reach here."); - } catch (BadError e) { + } catch (NoClassDefFoundError e) { System.out.println(e); + System.out.println(e.getCause()); } } catch (Exception error) { error.printStackTrace(); @@ -120,8 +121,9 @@ public class Main { try { BadInitNoStringInit.dummy = 1; throw new IllegalStateException("Should not reach here."); - } catch (BadErrorNoStringInit e) { + } catch (NoClassDefFoundError e) { System.out.println(e); + System.out.println(e.getCause()); } } catch (Exception error) { error.printStackTrace(); -- cgit v1.2.3-59-g8ed1b