Source:
public MSF4JMessageProcessor() { ConfigProvider configProvider = DataHolder.getInstance().getConfigProvider(); MSF4JConfig msf4JConfig = null; if (configProvider == null) { if (DataHolder.getInstance().getBundleContext() != null) { throw new RuntimeException("Failed to populate MSF4J Configuration. Config Provider is Null."); } String deploymentYamlPath = System.getProperty(MSF4JConstants.DEPLOYMENT_YAML_SYS_PROPERTY); if (deploymentYamlPath == null || deploymentYamlPath.isEmpty()) { log.info("System property '" + MSF4JConstants.DEPLOYMENT_YAML_SYS_PROPERTY + "' is not set. Default deployment.yaml file will be used."); URL deploymentYamlUrl = MSF4JMessageProcessor.class.getResource("/deployment.yaml"); try { FileUtils.copyURLToFile(deploymentYamlUrl, Paths.get(MSF4JConstants.DEPLOYMENT_YAML_FILE_NAME).toFile()); deploymentYamlPath = Paths.get(MSF4JConstants.DEPLOYMENT_YAML_FILE_NAME).toString(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } else if (!Files.exists(Paths.get(deploymentYamlPath))) { String msg = "Couldn't find " + deploymentYamlPath; throw new RuntimeException(msg); } try { configProvider = ConfigProviderFactory.getConfigProvider(Paths.get(deploymentYamlPath), null); DataHolder.getInstance().setConfigProvider(configProvider); } catch (ConfigurationException e) { throw new RuntimeException("Error loading deployment.yaml Configuration", e); } } try { msf4JConfig = DataHolder.getInstance().getConfigProvider().getConfigurationObject(MSF4JConfig.class); } catch (ConfigurationException e) { log.error("Error loading configurations from deployment.yaml", e); msf4JConfig = new MSF4JConfig(); } executorService = Executors.newFixedThreadPool(msf4JConfig.getThreadCount(), new MSF4JThreadFactory( new ThreadGroup(msf4JConfig.getThreadPoolName()))); }

Target:
public MSF4JMessageProcessor() { ConfigProvider configProvider = DataHolder.getInstance().getConfigProvider(); MSF4JConfig msf4JConfig; if (configProvider == null) { if (DataHolder.getInstance().getBundleContext() != null) { throw new RuntimeException("Failed to populate MSF4J Configuration. Config Provider is Null."); } String deploymentYamlPath = System.getProperty(MSF4JConstants.DEPLOYMENT_YAML_SYS_PROPERTY); if (deploymentYamlPath == null || deploymentYamlPath.isEmpty()) { log.info("System property '" + MSF4JConstants.DEPLOYMENT_YAML_SYS_PROPERTY + "' is not set. Default deployment.yaml file will be used."); URL deploymentYamlUrl = MSF4JMessageProcessor.class.getResource("/" + MSF4JConstants.DEPLOYMENT_YAML_FILE); try { FileUtils.copyURLToFile(deploymentYamlUrl, Paths.get(MSF4JConstants.DEPLOYMENT_YAML_FILE).toFile()); deploymentYamlPath = Paths.get(MSF4JConstants.DEPLOYMENT_YAML_FILE).toString(); } catch (IOException e) { throw new RuntimeException("Error while getting default deployment.yaml", e); } } else if (!Files.exists(Paths.get(deploymentYamlPath))) { throw new RuntimeException("Couldn't find " + deploymentYamlPath); } try { configProvider = ConfigProviderFactory.getConfigProvider(Paths.get(deploymentYamlPath), null); DataHolder.getInstance().setConfigProvider(configProvider); } catch (ConfigurationException e) { throw new RuntimeException("Error loading deployment.yaml Configuration", e); } } try { msf4JConfig = DataHolder.getInstance().getConfigProvider().getConfigurationObject(MSF4JConfig.class); } catch (ConfigurationException e) { throw new RuntimeException("Error while loading " + MSF4JConfig.class.getName() + " from config provider", e); } executorService = Executors.newFixedThreadPool(msf4JConfig.getThreadCount(), new MSF4JThreadFactory( new ThreadGroup(msf4JConfig.getThreadPoolName()))); }