/** * Handles exceptions thrown during the execution of this task. * * @param exception * the thrown exception. */ public void handleError(Exception exception) { try { if (command instanceof ErrorHandlingCommand) { ErrorHandlingCommand errorHandlingCommand = (ErrorHandlingCommand) command; errorHandlingCommand.handleError(exception); } else { ErrorEvent errorEvent = new ErrorEvent(exception); ErrorHandler errorHandler = ErrorEvent .findErrorHandler(session); if (errorHandler == null) { errorHandler = new DefaultErrorHandler(); } errorHandler.error(errorEvent); } } catch (Exception e) { getLogger().error(e.getMessage(), e); } }