Program: 29571
Project: 29571
Buggy source:
/** 
 * Undeploy a web application.
 * @param contextRoot    the context's name to undeploy
 * @param appName        the J2EE appname used at deployment time
 * @param virtualServers List of current virtual-server object.
 * @param dummy          true if the web module to be undeployed is a dummy webmodule, that is, a web module created off of a virtual server's docroot
 */
public void unloadWebModule(String contextRoot,String appName,String virtualServers,boolean dummy,Properties props){
  if (_logger.isLoggable(Level.FINEST)) {
    _logger.finest("String_Node_Str" + contextRoot + "String_Node_Str"+ appName);
  }
  if (contextRoot.length() != 0 && !contextRoot.startsWith("String_Node_Str")) {
    contextRoot="String_Node_Str" + contextRoot;
  }
 else   if ("String_Node_Str".equals(contextRoot)) {
    contextRoot="String_Node_Str";
  }
  List<String> hostList=StringUtils.parseStringList(virtualServers,"String_Node_Str");
  boolean unloadFromAll=hostList == null || hostList.isEmpty();
  boolean hasBeenUndeployed=false;
  VirtualServer host=null;
  WebModule context=null;
  Container[] hostArray=getEngine().findChildren();
  for (  Container aHostArray : hostArray) {
    host=(VirtualServer)aHostArray;
    if (unloadFromAll || hostList.contains(host.getName()) || verifyAlias(hostList,host)) {
      context=(WebModule)host.findChild(contextRoot);
      if (context != null) {
        context.saveSessions(props);
        host.removeChild(context);
        webStatsProviderBootstrap.unregisterApplicationStatsProviders(context.getMonitoringNodeName(),host.getName());
        try {
          if (!isShutdown) {
            context.destroy();
          }
        }
 catch (        Exception ex) {
          String msg=rb.getString("String_Node_Str");
          msg=MessageFormat.format(msg,contextRoot,host.getName());
          _logger.log(Level.WARNING,msg,ex);
        }
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str" + contextRoot + "String_Node_Str"+ host);
        }
        hasBeenUndeployed=true;
        host.fireContainerEvent(Deployer.REMOVE_EVENT,context);
        if (context.hasAdHocPaths() || context.hasAdHocSubtrees()) {
          WebModule wm=createAdHocWebModule(context.getID(),host,contextRoot,context.getJ2EEApplication());
          wm.addAdHocPaths(context.getAdHocPaths());
          wm.addAdHocSubtrees(context.getAdHocSubtrees());
        }
        if (!dummy && !isShutdown) {
          WebModuleConfig wmInfo=host.createSystemDefaultWebModuleIfNecessary(habitat.getComponent(WebArchivist.class));
          if (wmInfo != null) {
            loadStandaloneWebModule(host,wmInfo);
          }
        }
      }
    }
  }
  if (!hasBeenUndeployed) {
    _logger.log(Level.SEVERE,"String_Node_Str",contextRoot);
  }
}

Fixed version (ground truth):
/** 
 * Undeploy a web application.
 * @param contextRoot    the context's name to undeploy
 * @param appName        the J2EE appname used at deployment time
 * @param virtualServers List of current virtual-server object.
 * @param dummy          true if the web module to be undeployed is a dummy webmodule, that is, a web module created off of a virtual server's docroot
 */
public void unloadWebModule(String contextRoot,String appName,String virtualServers,boolean dummy,Properties props){
  if (_logger.isLoggable(Level.FINEST)) {
    _logger.finest("String_Node_Str" + contextRoot + "String_Node_Str"+ appName);
  }
  if (contextRoot.length() != 0 && !contextRoot.startsWith("String_Node_Str")) {
    contextRoot="String_Node_Str" + contextRoot;
  }
 else   if ("String_Node_Str".equals(contextRoot)) {
    contextRoot="String_Node_Str";
  }
  List<String> hostList=StringUtils.parseStringList(virtualServers,"String_Node_Str");
  boolean unloadFromAll=hostList == null || hostList.isEmpty();
  boolean hasBeenUndeployed=false;
  VirtualServer host=null;
  WebModule context=null;
  Container[] hostArray=getEngine().findChildren();
  for (  Container aHostArray : hostArray) {
    host=(VirtualServer)aHostArray;
    if (unloadFromAll || hostList.contains(host.getName()) || verifyAlias(hostList,host)) {
      context=(WebModule)host.findChild(contextRoot);
      if (context != null && context.getWebBundleDescriptor().getApplication().getRegistrationName().equals(appName)) {
        context.saveSessions(props);
        host.removeChild(context);
        webStatsProviderBootstrap.unregisterApplicationStatsProviders(context.getMonitoringNodeName(),host.getName());
        try {
          if (!isShutdown) {
            context.destroy();
          }
        }
 catch (        Exception ex) {
          String msg=rb.getString("String_Node_Str");
          msg=MessageFormat.format(msg,contextRoot,host.getName());
          _logger.log(Level.WARNING,msg,ex);
        }
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str" + contextRoot + "String_Node_Str"+ host);
        }
        hasBeenUndeployed=true;
        host.fireContainerEvent(Deployer.REMOVE_EVENT,context);
        if (context.hasAdHocPaths() || context.hasAdHocSubtrees()) {
          WebModule wm=createAdHocWebModule(context.getID(),host,contextRoot,context.getJ2EEApplication());
          wm.addAdHocPaths(context.getAdHocPaths());
          wm.addAdHocSubtrees(context.getAdHocSubtrees());
        }
        if (!dummy && !isShutdown) {
          WebModuleConfig wmInfo=host.createSystemDefaultWebModuleIfNecessary(habitat.getComponent(WebArchivist.class));
          if (wmInfo != null) {
            loadStandaloneWebModule(host,wmInfo);
          }
        }
      }
    }
  }
  if (!hasBeenUndeployed) {
    _logger.log(Level.SEVERE,"String_Node_Str",contextRoot);
  }
}