@SuppressWarnings("TryFailThrowable") @Test public void errorOccurred_EnsureNoExceptionWhenNoNativeAccel() { LoggingImagingListener listener = new LoggingImagingListener(); Throwable thrown = new Throwable("Continuing in pure Java mode"); try { boolean recoverySuccess = listener.errorOccurred(thrown.getMessage(), thrown, getClass(), false); assertFalse(recoverySuccess); } catch (Throwable ignore) { } assertEquals(1, logHandler.logged.size()); LogRecord logRecord = logHandler.logged.get(0); assertEquals("Continuing in pure Java mode", logRecord.getMessage()); assertSame(thrown, logRecord.getThrown()); }
@Override public boolean errorOccurred( String message, Throwable thrown, Object where, boolean isRetryable) throws RuntimeException { Logger log = Logging.getLogger(LoggingImagingListener.class); if (message.contains("Continuing in pure Java mode")) { log.log(Level.FINER, message, thrown); return false; } else { log.log(Level.INFO, message, thrown); if (thrown instanceof RuntimeException && !(where instanceof OperationRegistry)) { throw (RuntimeException) thrown; } else { return false; } } }
LoggingImagingListener implements ImagingListener { @Override public boolean errorOccurred( String message, Throwable thrown, Object where, boolean isRetryable) throws RuntimeException { Logger log = Logging.getLogger(LoggingImagingListener.class); if (message.contains("Continuing in pure Java mode")) { log.log(Level.FINER, message, thrown); return false; } else { log.log(Level.INFO, message, thrown); if (thrown instanceof RuntimeException && !(where instanceof OperationRegistry)) { throw (RuntimeException) thrown; } else { return false; } } } }
LoggingImagingListener implements ImagingListener { @Override public boolean errorOccurred( String message, Throwable thrown, Object where, boolean isRetryable) throws RuntimeException { Logger log = Logging.getLogger(LoggingImagingListener.class); if (message.contains("Continuing in pure Java mode")) { log.log(Level.FINER, message, thrown); return false; } else { log.log(Level.INFO, message, thrown); if (thrown instanceof RuntimeException && !(where instanceof OperationRegistry)) { throw (RuntimeException) thrown; } else { return false; } } }  }
LoggingImagingListener implements ImagingListener { @Override public boolean errorOccurred( String message, Throwable thrown, Object where, boolean isRetryable) throws RuntimeException { Logger log = Logging.getLogger(LoggingImagingListener.class); if (message.contains("Continuing in pure Java mode")) { log.log(Level.FINER, message, thrown); return false; } else { log.log(Level.INFO, message, thrown); if (thrown instanceof RuntimeException && !(where instanceof OperationRegistry)) { throw (RuntimeException) thrown; } else { return false; } } }  @Override boolean errorOccurred(
            String message, Throwable thrown, Object where, boolean isRetryable); @Override String toString(); }
LoggingImagingListener implements ImagingListener { @Override public boolean errorOccurred( String message, Throwable thrown, Object where, boolean isRetryable) throws RuntimeException { Logger log = Logging.getLogger(LoggingImagingListener.class); if (message.contains("Continuing in pure Java mode")) { log.log(Level.FINER, message, thrown); return false; } else { log.log(Level.INFO, message, thrown); if (thrown instanceof RuntimeException && !(where instanceof OperationRegistry)) { throw (RuntimeException) thrown; } else { return false; } } }  @Override boolean errorOccurred(
            String message, Throwable thrown, Object where, boolean isRetryable); @Override String toString();  }