Source:
public static void startup(Properties props) throws ModuleMustStartException { String moduleListString = props.getProperty(ModuleConstants.RUNTIMEPROPERTY_MODULE_LIST_TO_LOAD); if (moduleListString == null || moduleListString.length() == 0) { log.debug("Starting all modules"); ModuleFactory.loadModules(); } else { log.debug("Starting all modules in this list: " + moduleListString); String[] moduleArray = moduleListString.split(" "); List<File> modulesToLoad = new ArrayList<>(); for (String modulePath : moduleArray) { if (modulePath != null && modulePath.length() > 0) { File file = new File(modulePath); if (file.exists()) { modulesToLoad.add(file); } else { InputStream stream = ModuleUtil.class.getClassLoader().getResourceAsStream(modulePath); if (stream != null) { try { String tmpDir = System.getProperty("java.io.tmpdir"); File expandedFile = File.createTempFile(file.getName() + "-", ".omod", new File(tmpDir)); FileOutputStream outStream = new FileOutputStream(expandedFile, false); OpenmrsUtil.copyFile(stream, outStream); modulesToLoad.add(expandedFile); expandedFile.deleteOnExit(); } catch (IOException io) { log.error("Unable to expand classpath found module: " + modulePath, io); } } else { log .error("Unable to load module at path: " + modulePath + " because no file exists there and it is not found on the classpath. (absolute path tried: " + file.getAbsolutePath() + ")"); } } } } ModuleFactory.loadModules(modulesToLoad); } ModuleFactory.startModules(); if (log.isDebugEnabled()) { Collection<Module> modules = ModuleFactory.getStartedModules(); if (modules == null || modules.isEmpty()) { log.debug("No modules loaded"); } else { log.debug("Found and loaded " + modules.size() + " module(s)"); } } checkOpenmrsCoreModulesStarted(); checkMandatoryModulesStarted(); }

Target:
public static void startup(Properties props) throws OpenmrsCoreModuleException { String moduleListString = props.getProperty(ModuleConstants.RUNTIMEPROPERTY_MODULE_LIST_TO_LOAD); if (moduleListString == null || moduleListString.length() == 0) { log.debug("Starting all modules"); ModuleFactory.loadModules(); } else { log.debug("Starting all modules in this list: " + moduleListString); String[] moduleArray = moduleListString.split(" "); List<File> modulesToLoad = new ArrayList<>(); for (String modulePath : moduleArray) { if (modulePath != null && modulePath.length() > 0) { File file = new File(modulePath); if (file.exists()) { modulesToLoad.add(file); } else { InputStream stream = ModuleUtil.class.getClassLoader().getResourceAsStream(modulePath); if (stream != null) { try { String tmpDir = System.getProperty("java.io.tmpdir"); File expandedFile = File.createTempFile(file.getName() + "-", ".omod", new File(tmpDir)); FileOutputStream outStream = new FileOutputStream(expandedFile, false); OpenmrsUtil.copyFile(stream, outStream); modulesToLoad.add(expandedFile); expandedFile.deleteOnExit(); } catch (IOException io) { log.error("Unable to expand classpath found module: " + modulePath, io); } } else { log .error("Unable to load module at path: " + modulePath + " because no file exists there and it is not found on the classpath. (absolute path tried: " + file.getAbsolutePath() + ")"); } } } } ModuleFactory.loadModules(modulesToLoad); } ModuleFactory.startModules(); if (log.isDebugEnabled()) { Collection<Module> modules = ModuleFactory.getStartedModules(); if (modules == null || modules.isEmpty()) { log.debug("No modules loaded"); } else { log.debug("Found and loaded " + modules.size() + " module(s)"); } } checkOpenmrsCoreModulesStarted(); checkMandatoryModulesStarted(); }