Program: 29737
Project: 29737
Buggy source:
/** 
 * Process the application configuration file, if it exists.
 */
protected void applicationConfig() throws LifecycleException {
  String altDDName=null;
  InputStream stream=null;
  ServletContext servletContext=context.getServletContext();
  if (servletContext != null) {
    altDDName=(String)servletContext.getAttribute(Globals.ALT_DD_ATTR);
    if (altDDName != null) {
      try {
        stream=new FileInputStream(altDDName);
      }
 catch (      FileNotFoundException e) {
        throw new LifecycleException(sm.getString("String_Node_Str",altDDName));
      }
    }
 else {
      stream=servletContext.getResourceAsStream(Constants.ApplicationWebXml);
    }
  }
  if (stream == null) {
    if (log.isLoggable(Level.FINE)) {
      log.fine(sm.getString("String_Node_Str") + "String_Node_Str" + context);
    }
    return;
  }
  long t1=System.currentTimeMillis();
  URL url=null;
synchronized (webDigester) {
    try {
      if (altDDName != null) {
        url=new File(altDDName).toURL();
      }
 else {
        url=servletContext.getResource(Constants.ApplicationWebXml);
      }
      if (url != null) {
        InputSource is=new InputSource(url.toExternalForm());
        is.setByteStream(stream);
        webDigester.clear();
        webDigester.setDebug(getDebug());
        if (context instanceof StandardContext) {
          ((StandardContext)context).setReplaceWelcomeFiles(true);
        }
        webDigester.setUseContextClassLoader(false);
        webDigester.push(context);
        webDigester.parse(is);
      }
 else {
        if (log.isLoggable(Level.INFO)) {
          log.info("String_Node_Str" + context);
        }
      }
    }
 catch (    SAXParseException e) {
      throw new LifecycleException(sm.getString("String_Node_Str",e.getLineNumber(),e.getColumnNumber()),e);
    }
catch (    Exception e) {
      throw new LifecycleException(sm.getString("String_Node_Str"),e);
    }
 finally {
      try {
        if (stream != null) {
          stream.close();
        }
      }
 catch (      IOException e) {
        log.log(Level.SEVERE,sm.getString("String_Node_Str"),e);
      }
      webDigester.push(null);
    }
  }
  webRuleSet.recycle();
  long t2=System.currentTimeMillis();
  if (context instanceof StandardContext) {
    ((StandardContext)context).setStartupTime(t2 - t1);
  }
}

Fixed version (ground truth):
/** 
 * Process the application configuration file, if it exists.
 */
protected void applicationConfig() throws LifecycleException {
  String altDDName=null;
  InputStream stream=null;
  ServletContext servletContext=context.getServletContext();
  if (servletContext != null) {
    altDDName=(String)servletContext.getAttribute(Globals.ALT_DD_ATTR);
    if (altDDName != null) {
      try {
        stream=new FileInputStream(altDDName);
      }
 catch (      FileNotFoundException e) {
        throw new LifecycleException(sm.getString("String_Node_Str",altDDName));
      }
    }
 else {
      stream=servletContext.getResourceAsStream(Constants.ApplicationWebXml);
    }
  }
  if (stream == null) {
    if (log.isLoggable(Level.FINE)) {
      log.fine(sm.getString("String_Node_Str") + "String_Node_Str" + context);
    }
    return;
  }
  long t1=System.currentTimeMillis();
  URL url=null;
synchronized (webDigester) {
    try {
      if (altDDName != null) {
        url=new File(altDDName).toURL();
      }
 else {
        url=servletContext.getResource(Constants.ApplicationWebXml);
      }
      if (url != null) {
        InputSource is=new InputSource(url.toExternalForm());
        is.setByteStream(stream);
        webDigester.clear();
        webDigester.setDebug(getDebug());
        if (context instanceof StandardContext) {
          ((StandardContext)context).setReplaceWelcomeFiles(true);
        }
        webDigester.setUseContextClassLoader(false);
        webDigester.push(context);
        webDigester.parse(is);
      }
 else {
        if (log.isLoggable(Level.INFO)) {
          log.info("String_Node_Str" + context);
        }
      }
    }
 catch (    SAXParseException e) {
      throw new LifecycleException(sm.getString("String_Node_Str",e.getLineNumber(),e.getColumnNumber()),e);
    }
catch (    Exception e) {
      throw new LifecycleException(sm.getString("String_Node_Str"),e);
    }
 finally {
      try {
        stream.close();
      }
 catch (      IOException e) {
        log.log(Level.SEVERE,sm.getString("String_Node_Str"),e);
      }
      webDigester.push(null);
    }
  }
  webRuleSet.recycle();
  long t2=System.currentTimeMillis();
  if (context instanceof StandardContext) {
    ((StandardContext)context).setStartupTime(t2 - t1);
  }
}