Program: 83201
Project: 83201
Buggy source:
private void doGetPublicFile(HttpServletRequest request,HttpServletResponse response,TreeLogger logger,String partialPath,String moduleName) throws IOException {
  String msg="String_Node_Str" + partialPath + "String_Node_Str"+ moduleName+ "String_Node_Str";
  logger=logger.branch(TreeLogger.TRACE,msg,null);
  if (autoGenerateResources(request,response,logger,partialPath,moduleName)) {
    return;
  }
  URL foundResource;
  try {
    ModuleDef moduleDef=getModuleDef(logger,moduleName);
    foundResource=moduleDef.findPublicFile(partialPath);
    if (foundResource == null) {
      File moduleDir=new File(getOutputDir(),moduleName);
      File requestedFile=new File(moduleDir,partialPath);
      if (requestedFile.exists()) {
        try {
          foundResource=requestedFile.toURL();
        }
 catch (        MalformedURLException e) {
        }
      }
      if (foundResource == null) {
        msg="String_Node_Str" + partialPath;
        logger.log(TreeLogger.WARN,msg,null);
        throw new UnableToCompleteException();
      }
    }
  }
 catch (  UnableToCompleteException e) {
    sendErrorResponse(response,HttpServletResponse.SC_NOT_FOUND,"String_Node_Str" + partialPath + "String_Node_Str"+ moduleName+ "String_Node_Str");
    return;
  }
  String path=foundResource.toExternalForm();
  String mimeType=null;
  try {
    mimeType=getServletContext().getMimeType(path);
  }
 catch (  UnsupportedOperationException e) {
  }
  if (mimeType == null) {
    mimeType=guessMimeType(path);
    msg="String_Node_Str" + mimeType + "String_Node_Str";
    logger.log(TreeLogger.TRACE,msg,null);
  }
  maybeIssueXhtmlWarning(logger,mimeType,partialPath);
  boolean infinitelyCacheable=isInfinitelyCacheable(path);
  InputStream is=null;
  try {
    URLConnection conn=foundResource.openConnection();
    long lastModified=conn.getLastModified();
    if (isNotModified(request,lastModified)) {
      response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
      if (infinitelyCacheable) {
        response.setHeader(HttpHeaders.CACHE_CONTROL,HttpHeaders.CACHE_CONTROL_MAXAGE_FOREVER);
      }
      return;
    }
    response.setStatus(HttpServletResponse.SC_OK);
    long now=new Date().getTime();
    response.setHeader(HttpHeaders.DATE,HttpHeaders.toInternetDateFormat(now));
    response.setContentType(mimeType);
    String lastModifiedStr=HttpHeaders.toInternetDateFormat(lastModified);
    response.setHeader(HttpHeaders.LAST_MODIFIED,lastModifiedStr);
    String maxAgeStr;
    if (infinitelyCacheable) {
      maxAgeStr=HttpHeaders.CACHE_CONTROL_MAXAGE_FOREVER;
    }
 else {
      maxAgeStr=HttpHeaders.CACHE_CONTROL_MAXAGE_EXPIRED;
    }
    response.setHeader(HttpHeaders.CACHE_CONTROL,maxAgeStr);
    int contentLength=conn.getContentLength();
    if (contentLength >= 0) {
      response.setHeader(HttpHeaders.CONTENT_LENGTH,Integer.toString(contentLength));
    }
    is=foundResource.openStream();
    streamOut(is,response.getOutputStream(),1024 * 8);
  }
  finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException swallowed) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Fetch a file and return it as the HTTP response, setting the cache-related headers according to the name of the file (see  {@link #getCacheTime(String)}). This function honors If-Modified-Since to minimize the impact of limiting caching of files for development.
 * @param request the HTTP request
 * @param response the HTTP response
 * @param logger a TreeLogger to use for debug output
 * @param partialPath the path within the module
 * @param moduleName the name of the module
 * @throws IOException
 */
private void doGetPublicFile(HttpServletRequest request,HttpServletResponse response,TreeLogger logger,String partialPath,String moduleName) throws IOException {
  String msg="String_Node_Str" + partialPath + "String_Node_Str"+ moduleName+ "String_Node_Str";
  logger=logger.branch(TreeLogger.TRACE,msg,null);
  if (autoGenerateResources(request,response,logger,partialPath,moduleName)) {
    return;
  }
  URL foundResource;
  try {
    ModuleDef moduleDef=getModuleDef(logger,moduleName);
    foundResource=moduleDef.findPublicFile(partialPath);
    if (foundResource == null) {
      File moduleDir=new File(getOutputDir(),moduleName);
      File requestedFile=new File(moduleDir,partialPath);
      if (requestedFile.exists()) {
        try {
          foundResource=requestedFile.toURL();
        }
 catch (        MalformedURLException e) {
        }
      }
      if (foundResource == null) {
        msg="String_Node_Str" + partialPath;
        logger.log(TreeLogger.WARN,msg,null);
        throw new UnableToCompleteException();
      }
    }
  }
 catch (  UnableToCompleteException e) {
    sendErrorResponse(response,HttpServletResponse.SC_NOT_FOUND,"String_Node_Str" + partialPath + "String_Node_Str"+ moduleName+ "String_Node_Str");
    return;
  }
  String path=foundResource.toExternalForm();
  String mimeType=null;
  try {
    mimeType=getServletContext().getMimeType(path);
  }
 catch (  UnsupportedOperationException e) {
  }
  if (mimeType == null) {
    mimeType=guessMimeType(path);
    msg="String_Node_Str" + mimeType + "String_Node_Str";
    logger.log(TreeLogger.TRACE,msg,null);
  }
  maybeIssueXhtmlWarning(logger,mimeType,partialPath);
  long cacheSeconds=getCacheTime(path);
  InputStream is=null;
  try {
    URLConnection conn=foundResource.openConnection();
    long lastModified=conn.getLastModified();
    if (isNotModified(request,lastModified)) {
      response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
      setResponseCacheHeaders(response,cacheSeconds);
      return;
    }
    response.setStatus(HttpServletResponse.SC_OK);
    long now=new Date().getTime();
    response.setHeader(HttpHeaders.DATE,HttpHeaders.toInternetDateFormat(now));
    response.setContentType(mimeType);
    String lastModifiedStr=HttpHeaders.toInternetDateFormat(lastModified);
    response.setHeader(HttpHeaders.LAST_MODIFIED,lastModifiedStr);
    setResponseCacheHeaders(response,cacheSeconds);
    int contentLength=conn.getContentLength();
    if (contentLength >= 0) {
      response.setHeader(HttpHeaders.CONTENT_LENGTH,Integer.toString(contentLength));
    }
    is=foundResource.openStream();
    streamOut(is,response.getOutputStream(),1024 * 8);
  }
  finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException swallowed) {
      }
    }
  }
}