Program: 84571
Project: 84571
Buggy source:
/** 
 * Runs through extensionPoints and then calls mod.Activator.startup()
 * @param module Module to start
 */
public static Module startModule(Module module) throws ModuleException {
  if (module != null) {
    try {
      String requireVersion=module.getRequireOpenmrsVersion();
      if (requireVersion != null && !requireVersion.equals("String_Node_Str"))       if (ModuleUtil.compareVersion(OpenmrsConstants.OPENMRS_VERSION_SHORT,requireVersion) < 0)       throw new ModuleException("String_Node_Str" + requireVersion + "String_Node_Str"+ OpenmrsConstants.OPENMRS_VERSION_SHORT+ "String_Node_Str",module.getName());
      String requireDBVersion=module.getRequireDatabaseVersion();
      if (requireDBVersion != null && !requireDBVersion.equals("String_Node_Str"))       if (ModuleUtil.compareVersion(OpenmrsConstants.DATABASE_VERSION,requireDBVersion) < 0)       throw new ModuleException("String_Node_Str" + requireDBVersion + "String_Node_Str"+ OpenmrsConstants.DATABASE_VERSION+ "String_Node_Str",module.getName());
      if (!requiredModulesStarted(module)) {
        throw new ModuleException("String_Node_Str" + OpenmrsUtil.join(module.getRequiredModules(),"String_Node_Str") + "String_Node_Str",module.getName());
      }
      ModuleClassLoader moduleClassLoader=new ModuleClassLoader(module,ModuleFactory.class.getClassLoader());
      getModuleClassLoaderMap().put(module,moduleClassLoader);
      for (      Extension ext : module.getExtensions()) {
        String extId=ext.getExtensionId();
        List<Extension> tmpExtensions=getExtensions(extId);
        if (tmpExtensions == null)         tmpExtensions=new Vector<Extension>();
        log.debug("String_Node_Str" + ext.getExtensionId() + "String_Node_Str"+ ext.getClass());
        tmpExtensions.add(ext);
        getExtensionMap().put(extId,tmpExtensions);
      }
      SortedMap<String,String> diffs=SqlDiffFileParser.getSqlDiffs(module);
      try {
        Context.addProxyPrivilege("String_Node_Str");
        for (        String version : diffs.keySet()) {
          String sql=diffs.get(version);
          if (StringUtils.hasText(sql))           runDiff(module,version,sql);
        }
      }
  finally {
        Context.removeProxyPrivilege("String_Node_Str");
      }
      getStartedModulesMap().put(module.getModuleId(),module);
      try {
        Context.addProxyPrivilege("String_Node_Str");
        AdministrationService as=Context.getAdministrationService();
        GlobalProperty gp=new GlobalProperty(module.getModuleId() + "String_Node_Str","String_Node_Str",getGlobalPropertyStartedDescription(module.getModuleId()));
        as.setGlobalProperty(gp);
      }
  finally {
        Context.removeProxyPrivilege("String_Node_Str");
      }
      if (module.getPrivileges().size() > 0 || module.getGlobalProperties().size() > 0) {
        log.debug("String_Node_Str");
        Context.checkCoreDataset();
      }
      try {
        module.getActivator().startup();
      }
 catch (      ModuleException e) {
        throw e;
      }
catch (      Exception e) {
        throw new ModuleException("String_Node_Str",e);
      }
      module.clearStartupError();
    }
 catch (    Exception e) {
      log.warn("String_Node_Str" + module.getModuleId(),e);
      module.setStartupErrorMessage("String_Node_Str" + e.getMessage());
      try {
        stopModule(module);
      }
 catch (      Exception e2) {
        log.debug("String_Node_Str" + module.getModuleId(),e2);
      }
    }
  }
  return module;
}

Fixed version (ground truth):
/** 
 * Runs through extensionPoints and then calls mod.Activator.startup()
 * @param module Module to start
 */
public static Module startModule(Module module) throws ModuleException {
  if (module != null) {
    try {
      String requireVersion=module.getRequireOpenmrsVersion();
      if (requireVersion != null && !requireVersion.equals("String_Node_Str"))       if (ModuleUtil.compareVersion(OpenmrsConstants.OPENMRS_VERSION_SHORT,requireVersion) < 0)       throw new ModuleException("String_Node_Str" + requireVersion + "String_Node_Str"+ OpenmrsConstants.OPENMRS_VERSION_SHORT+ "String_Node_Str",module.getName());
      String requireDBVersion=module.getRequireDatabaseVersion();
      if (requireDBVersion != null && !requireDBVersion.equals("String_Node_Str"))       if (ModuleUtil.compareVersion(OpenmrsConstants.DATABASE_VERSION,requireDBVersion) < 0)       throw new ModuleException("String_Node_Str" + requireDBVersion + "String_Node_Str"+ OpenmrsConstants.DATABASE_VERSION+ "String_Node_Str",module.getName());
      if (!requiredModulesStarted(module)) {
        throw new ModuleException("String_Node_Str" + OpenmrsUtil.join(module.getRequiredModules(),"String_Node_Str") + "String_Node_Str",module.getName());
      }
      ModuleClassLoader moduleClassLoader=new ModuleClassLoader(module,ModuleFactory.class.getClassLoader());
      getModuleClassLoaderMap().put(module,moduleClassLoader);
      for (      Extension ext : module.getExtensions()) {
        String extId=ext.getExtensionId();
        List<Extension> tmpExtensions=getExtensions(extId);
        if (tmpExtensions == null)         tmpExtensions=new Vector<Extension>();
        log.debug("String_Node_Str" + ext.getExtensionId() + "String_Node_Str"+ ext.getClass());
        tmpExtensions.add(ext);
        getExtensionMap().put(extId,tmpExtensions);
      }
      SortedMap<String,String> diffs=SqlDiffFileParser.getSqlDiffs(module);
      try {
        Context.addProxyPrivilege("String_Node_Str");
        for (        String version : diffs.keySet()) {
          String sql=diffs.get(version);
          if (StringUtils.hasText(sql))           runDiff(module,version,sql);
        }
      }
  finally {
        Context.removeProxyPrivilege("String_Node_Str");
      }
      getStartedModulesMap().put(module.getModuleId(),module);
      try {
        Context.addProxyPrivilege(OpenmrsConstants.PRIV_MANAGE_GLOBAL_PROPERTIES);
        AdministrationService as=Context.getAdministrationService();
        GlobalProperty gp=new GlobalProperty(module.getModuleId() + "String_Node_Str","String_Node_Str",getGlobalPropertyStartedDescription(module.getModuleId()));
        as.setGlobalProperty(gp);
      }
  finally {
        Context.removeProxyPrivilege(OpenmrsConstants.PRIV_MANAGE_GLOBAL_PROPERTIES);
      }
      if (module.getPrivileges().size() > 0 || module.getGlobalProperties().size() > 0) {
        log.debug("String_Node_Str");
        Context.checkCoreDataset();
      }
      try {
        module.getActivator().startup();
      }
 catch (      ModuleException e) {
        throw e;
      }
catch (      Exception e) {
        throw new ModuleException("String_Node_Str",e);
      }
      module.clearStartupError();
    }
 catch (    Exception e) {
      log.warn("String_Node_Str" + module.getModuleId(),e);
      module.setStartupErrorMessage("String_Node_Str" + e.getMessage());
      try {
        stopModule(module);
      }
 catch (      Exception e2) {
        log.debug("String_Node_Str" + module.getModuleId(),e2);
      }
    }
  }
  return module;
}