Program: 29832
Project: 29832
Buggy source:
/** 
 * If a default web module has not yet been configured and added to this virtual server's list of web modules then return the configuration information needed in order to create a default web module for this virtual server. This method should be invoked only after all the standalone modules and the modules within j2ee-application elements have been added to this virtual server's list of modules (only then will one know whether the user has already configured a default web module or not).
 */
public WebModuleConfig createSystemDefaultWebModuleIfNecessary(WebArchivist webArchivist){
  WebModuleConfig wmInfo=null;
  String docroot=getAppBase();
  if (getDefaultWebModuleID() == null && findChild("String_Node_Str") == null && docroot != null) {
    WebBundleDescriptor wbd=webArchivist.getDefaultWebXmlBundleDescriptor();
    wmInfo=new WebModuleConfig();
    wbd.setModuleID(Constants.DEFAULT_WEB_MODULE_NAME);
    wbd.setContextRoot("String_Node_Str");
    wmInfo.setLocation(new File(docroot));
    wmInfo.setDescriptor(wbd);
    wmInfo.setParentLoader(serverContext.getCommonClassLoader());
    WebappClassLoader loader=new WebappClassLoader(wmInfo.getParentLoader());
    loader.start();
    wmInfo.setAppClassLoader(loader);
    if (wbd.getApplication() == null) {
      Application application=Application.createApplication();
      application.setVirtual(true);
      application.setName(Constants.DEFAULT_WEB_MODULE_NAME);
      wbd.setApplication(application);
    }
  }
  return wmInfo;
}

Fixed version (ground truth):
/** 
 * If a default web module has not yet been configured and added to this virtual server's list of web modules then return the configuration information needed in order to create a default web module for this virtual server. This method should be invoked only after all the standalone modules and the modules within j2ee-application elements have been added to this virtual server's list of modules (only then will one know whether the user has already configured a default web module or not).
 */
public WebModuleConfig createSystemDefaultWebModuleIfNecessary(WebArchivist webArchivist){
  WebModuleConfig wmInfo=null;
  String docroot=getAppBase();
  if (getDefaultWebModuleID() == null && findChild("String_Node_Str") == null && docroot != null) {
    WebBundleDescriptor wbd=webArchivist.getDefaultWebXmlBundleDescriptor();
    wmInfo=new WebModuleConfig();
    wbd.setModuleID(Constants.DEFAULT_WEB_MODULE_NAME);
    wbd.setContextRoot("String_Node_Str");
    wmInfo.setLocation(new File(docroot));
    wmInfo.setDescriptor(wbd);
    wmInfo.setParentLoader(serverContext.getCommonClassLoader());
    WebappClassLoader loader=AccessController.doPrivileged(new PrivilegedAction<WebappClassLoader>(){
      @Override public WebappClassLoader run(){
        return new WebappClassLoader(serverContext.getCommonClassLoader());
      }
    }
);
    loader.start();
    wmInfo.setAppClassLoader(loader);
    if (wbd.getApplication() == null) {
      Application application=Application.createApplication();
      application.setVirtual(true);
      application.setName(Constants.DEFAULT_WEB_MODULE_NAME);
      wbd.setApplication(application);
    }
  }
  return wmInfo;
}