/* * @bug 8003471 * @test TestExceptionEvents * @build ThrowableTracer * @run main/othervm ThrowableTraceTest */ public class ThrowableTraceTest { public ThrowableTraceTest() throws Exception { ThrowableTracer t = new ThrowableTracer(); ThrowableTracer.enable(t); int exceptionsToThrow = 5; int errorsToThrow = 5; for (int i = 0; i < exceptionsToThrow; i++) { try { throw new Exception(); } catch (Exception e) { } } for (int i = 0; i < errorsToThrow; i++) { try { throw new Error(); } catch (Error e) { } } if (t.getExceptions() < exceptionsToThrow) { throw new Exception ("Not enough errors events generated!"); } if (t.getErrors() < errorsToThrow) { throw new Exception ("Not enough errors events generated!"); } } public static void main(String[] args) throws Exception { new ThrowableTraceTest(); } }