@@ -0,0 +1,1938 @@
+package com.github.aureliano.evtbridge.core.helper;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.apache.log4j.Logger;%0A%0Aimport com.github.aureliano.evtbridge.core.command.DataIterationCommand;%0Aimport com.github.aureliano.evtbridge.core.config.IConfigInput;%0Aimport com.github.aureliano.evtbridge.core.exception.IExceptionHandler;%0A%0Apublic final class ExceptionHandlerHelper %7B%0A%0A%09private static final Logger logger = Logger.getLogger(ExceptionHandlerHelper.class);%0A%09%0A%09private ExceptionHandlerHelper() %7B%0A%09%09super();%0A%09%7D%0A%09%0A%09public static void executeHandlingException(DataIterationCommand command) %7B%0A%09%09try %7B%0A%09%09%09command.execute();%0A%09%09%7D catch (Exception ex) %7B%0A%09%09%09handleException(command, ex);%0A%09%09%09ExceptionHandlerHelper.configureCommandLogExecutionForException(command, ex);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static void configureCommandLogExecutionForException(DataIterationCommand command, Throwable exception) %7B%0A%09%09IConfigInput inputConfig = (IConfigInput) command.getDataReader().getConfiguration();%0A%09%09Map%3CString, Object%3E logExecution = command.getLogExecution();%0A%09%09%0A%09%09if (logExecution == null) %7B%0A%09%09%09logExecution = new HashMap%3CString, Object%3E();%0A%09%09%09command.setLogExecution(logExecution);%0A%09%09%7D%0A%09%09%0A%09%09String prefix = %22input.config.%22 + inputConfig.getConfigurationId() + %22.%22;%0A%09%09logExecution.put(prefix + %22exception%22, exception.getMessage());%0A%09%09logExecution.put(prefix + %22stackTrace%22, Arrays.asList(exception.getStackTrace()));%0A%09%7D%0A%09%0A%09private static void handleException(DataIterationCommand command, Exception ex) %7B%0A%09%09IConfigInput inputConfig = (IConfigInput) command.getDataReader().getConfiguration();%0A%09%09List%3CIExceptionHandler%3E handlers = inputConfig.getExceptionHandlers();%0A%09%09%0A%09%09Thread thread = Thread.currentThread();%0A%09%09%0A%09%09for (IExceptionHandler handler : handlers) %7B%0A%09%09%09handler.captureException(thread, inputConfig, ex);%0A%09%09%7D%0A%09%09%0A%09%09if (handlers.isEmpty()) %7B%0A%09%09%09logger.error(ex.getMessage(), ex);%0A%09%09%7D%0A%09%7D%0A%7D

Create exception handler helper.