diff --git a/core/src/main/java/com/wgzhao/addax/core/Engine.java b/core/src/main/java/com/wgzhao/addax/core/Engine.java index 96bad4727..a46ade106 100644 --- a/core/src/main/java/com/wgzhao/addax/core/Engine.java +++ b/core/src/main/java/com/wgzhao/addax/core/Engine.java @@ -43,11 +43,13 @@ /** * Engine是 Addax 入口类,该类负责初始化Job或者Task的运行容器,并运行插件的Job或者Task逻辑 */ -public class Engine { +public class Engine +{ private static final Logger LOG = LoggerFactory.getLogger(Engine.class); /* check job model (job/task) first */ - public void start(Configuration allConf) { + public void start(Configuration allConf) + { // 绑定column转换信息 ColumnCast.bind(allConf); @@ -65,7 +67,8 @@ public void start(Configuration allConf) { } // 注意屏蔽敏感信息 - public static String filterJobConfiguration(final Configuration configuration) { + public static String filterJobConfiguration(final Configuration configuration) + { Configuration jobConfWithSetting = configuration.getConfiguration("job").clone(); Configuration jobContent = jobConfWithSetting.getConfiguration("content"); @@ -77,7 +80,8 @@ public static String filterJobConfiguration(final Configuration configuration) { return jobConfWithSetting.beautify(); } - public static void filterSensitiveConfiguration(Configuration configuration) { + public static void filterSensitiveConfiguration(Configuration configuration) + { Set keys = configuration.getKeys(); for (String key : keys) { boolean isSensitive = StringUtils.endsWithIgnoreCase(key, "password") @@ -90,7 +94,8 @@ public static void filterSensitiveConfiguration(Configuration configuration) { } public static void entry(String[] args) - throws Throwable { + throws Throwable + { Options options = new Options(); options.addOption("job", true, "Job config."); @@ -115,39 +120,39 @@ public static void entry(String[] args) engine.start(configuration); } - public static String getVersion() { + public static String getVersion() + { try { final Properties properties = new Properties(); properties.load(Engine.class.getClassLoader().getResourceAsStream("project.properties")); return properties.getProperty("version"); - } catch (IOException e) { + } + catch (IOException e) { return null; } } - public static void main(String[] args) { + public static void main(String[] args) + { LOG.info("\n ___ _ _ \n" + " / _ \\ | | | | \n" + "/ /_\\ \\ __| | __| | __ ___ __\n" + "| _ |/ _` |/ _` |/ _` \\ \\/ /\n" + "| | | | (_| | (_| | (_| |> < \n" + - "\\_| |_/\\__,_|\\__,_|\\__,_/_/\\_\\\n"+ - ":: Addax version :: (v{})", Engine.getVersion()); + "\\_| |_/\\__,_|\\__,_|\\__,_/_/\\_\\\n" + + ":: Addax version :: (v{})", Engine.getVersion()); if (args.length < 2) { LOG.error("need a job file"); System.exit(1); } try { Engine.entry(args); - } catch (Throwable e) { - if (e instanceof AddaxException) { - LOG.error(e.getMessage()); - } else { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - e.printStackTrace(pw); - LOG.error(sw.toString()); - } + } + catch (Throwable e) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + LOG.error(sw.toString()); System.exit(2); } System.exit(0);