Program: 29668
Project: 29668
Buggy source:
/** 
 * Configure the repositories for our class loader, based on the associated Context.
 */
private void setRepositories(){
  if (!(container instanceof Context))   return;
  ServletContext servletContext=((Context)container).getServletContext();
  if (servletContext == null)   return;
  File workDir=(File)servletContext.getAttribute(ServletContext.TEMPDIR);
  if (workDir == null) {
    if (log.isLoggable(Level.INFO)) {
      log.info("String_Node_Str" + servletContext);
    }
  }
  if (log.isLoggable(Level.FINEST) && workDir != null)   log.finest(sm.getString("String_Node_Str",workDir.getAbsolutePath()));
  DirContext resources=container.getResources();
  String classesPath="String_Node_Str";
  DirContext classes=null;
  try {
    Object object=resources.lookup(classesPath);
    if (object instanceof DirContext) {
      classes=(DirContext)object;
    }
  }
 catch (  NamingException e) {
  }
  if (classes != null) {
    File classRepository=null;
    String absoluteClassesPath=servletContext.getRealPath(classesPath);
    if (absoluteClassesPath != null) {
      classRepository=new File(absoluteClassesPath);
    }
 else {
      classRepository=new File(workDir,classesPath);
      classRepository.mkdirs();
      copyDir(classes,classRepository);
    }
    if (log.isLoggable(Level.FINEST))     log.finest(sm.getString("String_Node_Str",classesPath,classRepository.getAbsolutePath()));
  }
  String libPath="String_Node_Str";
  classLoader.setJarPath(libPath);
  DirContext libDir=null;
  try {
    Object object=resources.lookup(libPath);
    if (object instanceof DirContext)     libDir=(DirContext)object;
  }
 catch (  NamingException e) {
  }
  if (libDir != null) {
    boolean copyJars=false;
    String absoluteLibPath=servletContext.getRealPath(libPath);
    File destDir=null;
    if (absoluteLibPath != null) {
      destDir=new File(absoluteLibPath);
    }
 else {
      copyJars=true;
      destDir=new File(workDir,libPath);
      destDir.mkdirs();
    }
    if (!copyJars) {
      return;
    }
    try {
      NamingEnumeration<Binding> enumeration=resources.listBindings(libPath);
      while (enumeration.hasMoreElements()) {
        Binding binding=enumeration.nextElement();
        String filename=libPath + "String_Node_Str" + binding.getName();
        if (!filename.endsWith("String_Node_Str") && !filename.endsWith("String_Node_Str"))         continue;
        if (binding.getName() != null && binding.getName().startsWith("String_Node_Str") && ignoreHiddenJarFiles) {
          continue;
        }
        File destFile=new File(destDir,binding.getName());
        if (log.isLoggable(Level.FINEST)) {
          log.finest(sm.getString("String_Node_Str",filename,destFile.getAbsolutePath()));
        }
        Object obj=binding.getObject();
        if (!(obj instanceof Resource))         continue;
        Resource jarResource=(Resource)obj;
        if (!copy(jarResource.streamContent(),new FileOutputStream(destFile))) {
          continue;
        }
      }
    }
 catch (    NamingException e) {
    }
catch (    IOException e) {
      log("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Configure the repositories for our class loader, based on the associated Context.
 */
private void setRepositories() throws IOException {
  if (!(container instanceof Context))   return;
  ServletContext servletContext=((Context)container).getServletContext();
  if (servletContext == null)   return;
  File workDir=(File)servletContext.getAttribute(ServletContext.TEMPDIR);
  if (workDir == null) {
    if (log.isLoggable(Level.INFO)) {
      log.info("String_Node_Str" + servletContext);
    }
  }
  if (log.isLoggable(Level.FINEST) && workDir != null)   log.finest(sm.getString("String_Node_Str",workDir.getAbsolutePath()));
  DirContext resources=container.getResources();
  String classesPath="String_Node_Str";
  DirContext classes=null;
  try {
    Object object=resources.lookup(classesPath);
    if (object instanceof DirContext) {
      classes=(DirContext)object;
    }
  }
 catch (  NamingException e) {
  }
  if (classes != null) {
    File classRepository=null;
    String absoluteClassesPath=servletContext.getRealPath(classesPath);
    if (absoluteClassesPath != null) {
      classRepository=new File(absoluteClassesPath);
    }
 else {
      classRepository=new File(workDir,classesPath);
      if (!classRepository.mkdirs() && !classRepository.isDirectory()) {
        throw new IOException(sm.getString("String_Node_Str"));
      }
      if (!copyDir(classes,classRepository)) {
        throw new IOException(sm.getString("String_Node_Str"));
      }
    }
    if (log.isLoggable(Level.FINEST))     log.finest(sm.getString("String_Node_Str",classesPath,classRepository.getAbsolutePath()));
  }
  String libPath="String_Node_Str";
  classLoader.setJarPath(libPath);
  DirContext libDir=null;
  try {
    Object object=resources.lookup(libPath);
    if (object instanceof DirContext)     libDir=(DirContext)object;
  }
 catch (  NamingException e) {
  }
  if (libDir != null) {
    boolean copyJars=false;
    String absoluteLibPath=servletContext.getRealPath(libPath);
    File destDir=null;
    if (absoluteLibPath != null) {
      destDir=new File(absoluteLibPath);
    }
 else {
      copyJars=true;
      destDir=new File(workDir,libPath);
      if (!destDir.exists() && !destDir.mkdirs()) {
        log.log(Level.SEVERE,sm.getString("String_Node_Str",destDir.getAbsolutePath()));
      }
    }
    if (!copyJars) {
      return;
    }
    try {
      NamingEnumeration<Binding> enumeration=resources.listBindings(libPath);
      while (enumeration.hasMoreElements()) {
        Binding binding=enumeration.nextElement();
        String filename=libPath + "String_Node_Str" + binding.getName();
        if (!filename.endsWith("String_Node_Str") && !filename.endsWith("String_Node_Str"))         continue;
        if (binding.getName() != null && binding.getName().startsWith("String_Node_Str") && ignoreHiddenJarFiles) {
          continue;
        }
        File destFile=new File(destDir,binding.getName());
        if (log.isLoggable(Level.FINEST)) {
          log.finest(sm.getString("String_Node_Str",filename,destFile.getAbsolutePath()));
        }
        Object obj=binding.getObject();
        if (!(obj instanceof Resource))         continue;
        Resource jarResource=(Resource)obj;
        if (!copy(jarResource.streamContent(),new FileOutputStream(destFile))) {
          continue;
        }
      }
    }
 catch (    NamingException e) {
    }
catch (    IOException e) {
      log("String_Node_Str",e);
    }
  }
}