Program: 28227
Project: 28227
Buggy source:
/** 
 * Return a Source for the xsl template (if possible)
 */
protected Source findXsltInputStream(DirContext directory) throws IOException, ServletException {
  if (localXsltFile != null) {
    try {
      Object obj=directory.lookup(localXsltFile);
      if (obj != null && obj instanceof Resource) {
        InputStream is=((Resource)obj).streamContent();
        if (is != null) {
          if (Globals.IS_SECURITY_ENABLED) {
            return secureXslt(is);
          }
 else {
            return new StreamSource(is);
          }
        }
      }
    }
 catch (    Throwable e) {
      ;
      if (debug > 10)       log("String_Node_Str" + localXsltFile + "String_Node_Str",e);
      return null;
    }
  }
  if (contextXsltFile != null) {
    InputStream is=getServletContext().getResourceAsStream(contextXsltFile);
    if (is != null) {
      if (Globals.IS_SECURITY_ENABLED) {
        return secureXslt(is);
      }
 else {
        return new StreamSource(is);
      }
    }
    if (debug > 10)     log("String_Node_Str" + contextXsltFile + "String_Node_Str");
  }
  if (globalXsltFile != null) {
    File f=validateGlobalXsltFile();
    if (f != null) {
      FileInputStream fis=null;
      try {
        fis=new FileInputStream(f);
        byte b[]=new byte[(int)f.length()];
        fis.read(b);
        return new StreamSource(new ByteArrayInputStream(b));
      }
  finally {
        if (fis != null) {
          try {
            fis.close();
          }
 catch (          IOException ioe) {
            if (debug > 10) {
              log(ioe.getMessage(),ioe);
            }
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return a Source for the xsl template (if possible)
 */
protected Source findXsltInputStream(DirContext directory) throws IOException, ServletException {
  if (localXsltFile != null) {
    try {
      Object obj=directory.lookup(localXsltFile);
      if (obj != null && obj instanceof Resource) {
        InputStream is=((Resource)obj).streamContent();
        if (is != null) {
          if (Globals.IS_SECURITY_ENABLED) {
            return secureXslt(is);
          }
 else {
            return new StreamSource(is);
          }
        }
      }
    }
 catch (    Throwable e) {
      ;
      if (debug > 10)       log("String_Node_Str" + localXsltFile + "String_Node_Str",e);
      return null;
    }
  }
  if (contextXsltFile != null) {
    InputStream is=getServletContext().getResourceAsStream(contextXsltFile);
    if (is != null) {
      if (Globals.IS_SECURITY_ENABLED) {
        return secureXslt(is);
      }
 else {
        return new StreamSource(is);
      }
    }
    if (debug > 10)     log("String_Node_Str" + contextXsltFile + "String_Node_Str");
  }
  if (globalXsltFile != null) {
    File f=validateGlobalXsltFile();
    if (f != null) {
      FileInputStream fis=null;
      try {
        fis=new FileInputStream(f);
        long len=f.length();
        byte b[]=new byte[(int)len];
        if (len != fis.read(b)) {
          throw new IOException(MessageFormat.format(READ_FILE_EXCEPTION,f.getAbsolutePath()));
        }
        return new StreamSource(new ByteArrayInputStream(b));
      }
  finally {
        if (fis != null) {
          try {
            fis.close();
          }
 catch (          IOException ioe) {
            if (debug > 10) {
              log(ioe.getMessage(),ioe);
            }
          }
        }
      }
    }
  }
  return null;
}