< prev index next >

modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/ControlTestUtils.java

Print this page
rev 8906 : RT-46083: TimelineClipCore exceptions handling improvent

*** 229,234 **** --- 229,250 ---- ArrayList results = new ArrayList(); results.addAll(ExpressionHelperUtility.getChangeListeners(value)); results.addAll(ExpressionHelperUtility.getInvalidationListeners(value)); return results; } + + // methods for temporary setting UncaughtExceptionHandler + public static Thread.UncaughtExceptionHandler setHandler() { + Thread.UncaughtExceptionHandler exceptionHandler = Thread.currentThread().getUncaughtExceptionHandler(); + Thread.currentThread().setUncaughtExceptionHandler((Thread t, Throwable e) -> { + e.printStackTrace(); + throw new AssertionError(e); + }); + return exceptionHandler; + } + + // the test should call this method in the finally block to ensure + // that the handler is reset + public static void resetHandler(Thread.UncaughtExceptionHandler exceptionHandler) { + Thread.currentThread().setUncaughtExceptionHandler(exceptionHandler); + } }
< prev index next >