Program: 28494
Project: 28494
Buggy source:
public void postConstruct(){
  createProbeProviders();
  injectionMgr=habitat.getService(InjectionManager.class);
  invocationMgr=habitat.getService(InvocationManager.class);
  tldProviders=habitat.getAllServices(TldProvider.class);
  createStatsProviders();
  setJspFactory();
  _appsWorkRoot=instance.getApplicationCompileJspPath().getAbsolutePath();
  _modulesRoot=instance.getApplicationRepositoryPath();
  appsStubRoot=instance.getApplicationStubPath().getAbsolutePath();
  File root=_serverContext.getInstallRoot();
  File libRoot=new File(root,"String_Node_Str");
  File schemas=new File(libRoot,"String_Node_Str");
  File dtds=new File(libRoot,"String_Node_Str");
  try {
    ParserUtils.setSchemaResourcePrefix(schemas.toURI().toURL().toString());
    ParserUtils.setDtdResourcePrefix(dtds.toURI().toURL().toString());
    ParserUtils.setEntityResolver(habitat.<EntityResolver>getService(EntityResolver.class,"String_Node_Str"));
  }
 catch (  MalformedURLException e) {
    logger.log(Level.SEVERE,EXCEPTION_SET_SCHEMAS_DTDS_LOCATION,e);
  }
  instanceName=_serverContext.getInstanceName();
  webContainerFeatureFactory=getWebContainerFeatureFactory();
  configureDynamicReloadingSettings();
  setDebugLevel();
  String maxDepth=null;
  org.glassfish.web.config.serverbeans.WebContainer configWC=serverConfig.getExtensionByType(org.glassfish.web.config.serverbeans.WebContainer.class);
  if (configWC != null)   maxDepth=configWC.getPropertyValue(DISPATCHER_MAX_DEPTH);
  if (maxDepth != null) {
    int depth=-1;
    try {
      depth=Integer.parseInt(maxDepth);
    }
 catch (    NumberFormatException e) {
    }
    if (depth > 0) {
      Request.setMaxDispatchDepth(depth);
      if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE,MAX_DISPATCH_DEPTH_SET,maxDepth);
      }
    }
  }
  File currentLogFile=loggingRuntime.getCurrentLogFile();
  if (currentLogFile != null) {
    logServiceFile=currentLogFile.getAbsolutePath();
  }
  Level level=Logger.getLogger("String_Node_Str").getLevel();
  if (level != null) {
    logLevel=level.getName();
  }
  _embedded=habitat.getService(EmbeddedWebContainer.class);
  _embedded.setWebContainer(this);
  _embedded.setLogServiceFile(logServiceFile);
  _embedded.setLogLevel(logLevel);
  _embedded.setFileLoggerHandlerFactory(fileLoggerHandlerFactory);
  _embedded.setWebContainerFeatureFactory(webContainerFeatureFactory);
  _embedded.setCatalinaHome(instance.getDomainRoot().getAbsolutePath());
  _embedded.setCatalinaBase(instance.getDomainRoot().getAbsolutePath());
  _embedded.setUseNaming(false);
  if (_debug > 1)   _embedded.setDebug(_debug);
  _embedded.setLogger(new IASLogger(logger));
  engine=_embedded.createEngine();
  engine.setParentClassLoader(EmbeddedWebContainer.class.getClassLoader());
  engine.setService(_embedded);
  _embedded.addEngine(engine);
  ((StandardEngine)engine).setDomain(_serverContext.getDefaultDomainName());
  engine.setName(_serverContext.getDefaultDomainName());
  String serverInfo=System.getProperty("String_Node_Str");
  if (serverInfo == null) {
    ServerInfo.setServerInfo(Version.getVersion());
    ServerInfo.setPublicServerInfo(Version.getVersion());
  }
 else   if (serverInfo.isEmpty()) {
    ServerInfo.setServerInfo(Version.getVersion());
    ServerInfo.setPublicServerInfo(serverInfo);
  }
 else {
    ServerInfo.setServerInfo(serverInfo);
    ServerInfo.setPublicServerInfo(serverInfo);
  }
  initInstanceSessionProperties();
  configListener=addAndGetWebConfigListener();
  ObservableBean bean=(ObservableBean)ConfigSupport.getImpl(serverConfig.getHttpService());
  bean.addListener(configListener);
  bean=(ObservableBean)ConfigSupport.getImpl(serverConfig.getNetworkConfig().getNetworkListeners());
  bean.addListener(configListener);
  if (serverConfig.getAvailabilityService() != null) {
    bean=(ObservableBean)ConfigSupport.getImpl(serverConfig.getAvailabilityService());
    bean.addListener(configListener);
  }
  transactions.addListenerForType(SystemProperty.class,configListener);
  configListener.setNetworkConfig(serverConfig.getNetworkConfig());
  if (configListener.managerProperties != null) {
    ObservableBean managerBean=(ObservableBean)ConfigSupport.getImpl(configListener.managerProperties);
    managerBean.addListener(configListener);
  }
  if (serverConfig.getJavaConfig() != null) {
    ((ObservableBean)ConfigSupport.getImpl(serverConfig.getJavaConfig())).addListener(configListener);
  }
  configListener.setContainer(this);
  configListener.setLogger(logger);
  events.register(this);
  grizzlyService.addMapperUpdateListener(configListener);
  HttpService httpService=serverConfig.getHttpService();
  NetworkConfig networkConfig=serverConfig.getNetworkConfig();
  if (networkConfig != null) {
    securityService=serverConfig.getSecurityService();
    NetworkListeners networkListeners=networkConfig.getNetworkListeners();
    if (networkListeners != null) {
      List<NetworkListener> listeners=networkListeners.getNetworkListener();
      for (      NetworkListener listener : listeners) {
        createHttpListener(listener,httpService);
      }
    }
    setDefaultRedirectPort(defaultRedirectPort);
    createHosts(httpService,securityService);
  }
  loadSystemDefaultWebModules();
  _started=true;
  ClassLoader current=Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
  try {
    ImageIO.getCacheDirectory();
    _embedded.start();
  }
 catch (  LifecycleException le) {
    logger.log(Level.SEVERE,UNABLE_TO_START_WEB_CONTAINER,le);
    return;
  }
 finally {
    Thread.currentThread().setContextClassLoader(current);
  }
}

Fixed version (ground truth):
public void postConstruct(){
  final ReentrantReadWriteLock mapperLock=grizzlyService.obtainMapperLock();
  mapperLock.writeLock().lock();
  try {
    createProbeProviders();
    injectionMgr=habitat.getService(InjectionManager.class);
    invocationMgr=habitat.getService(InvocationManager.class);
    tldProviders=habitat.getAllServices(TldProvider.class);
    createStatsProviders();
    setJspFactory();
    _appsWorkRoot=instance.getApplicationCompileJspPath().getAbsolutePath();
    _modulesRoot=instance.getApplicationRepositoryPath();
    appsStubRoot=instance.getApplicationStubPath().getAbsolutePath();
    File root=_serverContext.getInstallRoot();
    File libRoot=new File(root,"String_Node_Str");
    File schemas=new File(libRoot,"String_Node_Str");
    File dtds=new File(libRoot,"String_Node_Str");
    try {
      ParserUtils.setSchemaResourcePrefix(schemas.toURI().toURL().toString());
      ParserUtils.setDtdResourcePrefix(dtds.toURI().toURL().toString());
      ParserUtils.setEntityResolver(habitat.<EntityResolver>getService(EntityResolver.class,"String_Node_Str"));
    }
 catch (    MalformedURLException e) {
      logger.log(Level.SEVERE,EXCEPTION_SET_SCHEMAS_DTDS_LOCATION,e);
    }
    instanceName=_serverContext.getInstanceName();
    webContainerFeatureFactory=getWebContainerFeatureFactory();
    configureDynamicReloadingSettings();
    setDebugLevel();
    String maxDepth=null;
    org.glassfish.web.config.serverbeans.WebContainer configWC=serverConfig.getExtensionByType(org.glassfish.web.config.serverbeans.WebContainer.class);
    if (configWC != null)     maxDepth=configWC.getPropertyValue(DISPATCHER_MAX_DEPTH);
    if (maxDepth != null) {
      int depth=-1;
      try {
        depth=Integer.parseInt(maxDepth);
      }
 catch (      NumberFormatException e) {
      }
      if (depth > 0) {
        Request.setMaxDispatchDepth(depth);
        if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE,MAX_DISPATCH_DEPTH_SET,maxDepth);
        }
      }
    }
    File currentLogFile=loggingRuntime.getCurrentLogFile();
    if (currentLogFile != null) {
      logServiceFile=currentLogFile.getAbsolutePath();
    }
    Level level=Logger.getLogger("String_Node_Str").getLevel();
    if (level != null) {
      logLevel=level.getName();
    }
    _embedded=habitat.getService(EmbeddedWebContainer.class);
    _embedded.setWebContainer(this);
    _embedded.setLogServiceFile(logServiceFile);
    _embedded.setLogLevel(logLevel);
    _embedded.setFileLoggerHandlerFactory(fileLoggerHandlerFactory);
    _embedded.setWebContainerFeatureFactory(webContainerFeatureFactory);
    _embedded.setCatalinaHome(instance.getDomainRoot().getAbsolutePath());
    _embedded.setCatalinaBase(instance.getDomainRoot().getAbsolutePath());
    _embedded.setUseNaming(false);
    if (_debug > 1)     _embedded.setDebug(_debug);
    _embedded.setLogger(new IASLogger(logger));
    engine=_embedded.createEngine();
    engine.setParentClassLoader(EmbeddedWebContainer.class.getClassLoader());
    engine.setService(_embedded);
    _embedded.addEngine(engine);
    ((StandardEngine)engine).setDomain(_serverContext.getDefaultDomainName());
    engine.setName(_serverContext.getDefaultDomainName());
    String serverInfo=System.getProperty("String_Node_Str");
    if (serverInfo == null) {
      ServerInfo.setServerInfo(Version.getVersion());
      ServerInfo.setPublicServerInfo(Version.getVersion());
    }
 else     if (serverInfo.isEmpty()) {
      ServerInfo.setServerInfo(Version.getVersion());
      ServerInfo.setPublicServerInfo(serverInfo);
    }
 else {
      ServerInfo.setServerInfo(serverInfo);
      ServerInfo.setPublicServerInfo(serverInfo);
    }
    initInstanceSessionProperties();
    configListener=addAndGetWebConfigListener();
    ObservableBean bean=(ObservableBean)ConfigSupport.getImpl(serverConfig.getHttpService());
    bean.addListener(configListener);
    bean=(ObservableBean)ConfigSupport.getImpl(serverConfig.getNetworkConfig().getNetworkListeners());
    bean.addListener(configListener);
    if (serverConfig.getAvailabilityService() != null) {
      bean=(ObservableBean)ConfigSupport.getImpl(serverConfig.getAvailabilityService());
      bean.addListener(configListener);
    }
    transactions.addListenerForType(SystemProperty.class,configListener);
    configListener.setNetworkConfig(serverConfig.getNetworkConfig());
    if (configListener.managerProperties != null) {
      ObservableBean managerBean=(ObservableBean)ConfigSupport.getImpl(configListener.managerProperties);
      managerBean.addListener(configListener);
    }
    if (serverConfig.getJavaConfig() != null) {
      ((ObservableBean)ConfigSupport.getImpl(serverConfig.getJavaConfig())).addListener(configListener);
    }
    configListener.setContainer(this);
    configListener.setLogger(logger);
    events.register(this);
    grizzlyService.addMapperUpdateListener(configListener);
    HttpService httpService=serverConfig.getHttpService();
    NetworkConfig networkConfig=serverConfig.getNetworkConfig();
    if (networkConfig != null) {
      securityService=serverConfig.getSecurityService();
      NetworkListeners networkListeners=networkConfig.getNetworkListeners();
      if (networkListeners != null) {
        List<NetworkListener> listeners=networkListeners.getNetworkListener();
        for (        NetworkListener listener : listeners) {
          createHttpListener(listener,httpService);
        }
      }
      setDefaultRedirectPort(defaultRedirectPort);
      createHosts(httpService,securityService);
    }
    loadSystemDefaultWebModules();
    _started=true;
    ClassLoader current=Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    try {
      ImageIO.getCacheDirectory();
      _embedded.start();
    }
 catch (    LifecycleException le) {
      logger.log(Level.SEVERE,UNABLE_TO_START_WEB_CONTAINER,le);
      return;
    }
 finally {
      Thread.currentThread().setContextClassLoader(current);
    }
  }
  finally {
    mapperLock.writeLock().unlock();
  }
}