Program: 29724
Project: 29724
Buggy source:
/** 
 * Deploy WAR files.
 */
protected void deployWARs(File appBase,String[] files){
  for (int i=0; i < files.length; i++) {
    if (files[i].equalsIgnoreCase("String_Node_Str"))     continue;
    if (files[i].equalsIgnoreCase("String_Node_Str"))     continue;
    if (deployed.contains(files[i]))     continue;
    File dir=new File(appBase,files[i]);
    if (files[i].toLowerCase(Locale.ENGLISH).endsWith("String_Node_Str") && dir.isFile() && !invalidWars.contains(files[i])) {
      deployed.add(files[i]);
      String contextPath="String_Node_Str" + files[i];
      int period=contextPath.lastIndexOf("String_Node_Str");
      if (period >= 0)       contextPath=contextPath.substring(0,period);
      if (!validateContextPath(appBase,contextPath)) {
        log.severe(sm.getString("String_Node_Str",files[i]));
        invalidWars.add(files[i]);
        continue;
      }
      if (contextPath.equals("String_Node_Str"))       contextPath="String_Node_Str";
      if (host.findChild(contextPath) != null)       continue;
      JarFile jar=null;
      JarEntry entry=null;
      InputStream istream=null;
      BufferedOutputStream ostream=null;
      File xml=new File(configBase,files[i].substring(0,files[i].lastIndexOf("String_Node_Str")) + "String_Node_Str");
      if (!xml.exists()) {
        try {
          jar=new JarFile(dir);
          entry=jar.getJarEntry("String_Node_Str");
          if (entry != null) {
            istream=jar.getInputStream(entry);
            ostream=new BufferedOutputStream(new FileOutputStream(xml),1024);
            byte buffer[]=new byte[1024];
            while (true) {
              int n=istream.read(buffer);
              if (n < 0) {
                break;
              }
              ostream.write(buffer,0,n);
            }
            ostream.flush();
            ostream.close();
            ostream=null;
            istream.close();
            istream=null;
            entry=null;
            jar.close();
            jar=null;
            deployDescriptors(configBase(),configBase.list());
            return;
          }
        }
 catch (        Exception e) {
          if (ostream != null) {
            try {
              ostream.close();
            }
 catch (            Throwable t) {
              ;
            }
            ostream=null;
          }
          if (istream != null) {
            try {
              istream.close();
            }
 catch (            Throwable t) {
              ;
            }
            istream=null;
          }
          entry=null;
          if (jar != null) {
            try {
              jar.close();
            }
 catch (            Throwable t) {
              ;
            }
            jar=null;
          }
        }
      }
      if (isUnpackWARs()) {
        if (log.isLoggable(Level.FINE)) {
          log.fine(sm.getString("String_Node_Str",files[i]));
        }
        URL url=null;
        String path=null;
        try {
          url=new URL("String_Node_Str" + dir.getCanonicalPath() + "String_Node_Str");
          path=ExpandWar.expand(host,url);
        }
 catch (        IOException e) {
          log.warning(sm.getString("String_Node_Str",files[i]));
          continue;
        }
catch (        Throwable t) {
          log.log(Level.SEVERE,sm.getString("String_Node_Str",files[i]),t);
          continue;
        }
        try {
          if (path != null) {
            url=new URL("String_Node_Str" + path);
            ((Deployer)host).install(contextPath,url);
          }
        }
 catch (        Throwable t) {
          log.log(Level.SEVERE,sm.getString("String_Node_Str",files[i]),t);
        }
      }
 else {
        if (log.isLoggable(Level.INFO)) {
          log.info(sm.getString("String_Node_Str",files[i]));
        }
        try {
          URL url=new URL("String_Node_Str",null,dir.getCanonicalPath());
          url=new URL("String_Node_Str" + url.toString() + "String_Node_Str");
          ((Deployer)host).install(contextPath,url);
        }
 catch (        Throwable t) {
          log.log(Level.SEVERE,sm.getString("String_Node_Str",files[i]),t);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Deploy WAR files.
 */
protected void deployWARs(File appBase,String[] files){
  for (int i=0; i < files.length; i++) {
    if (files[i].equalsIgnoreCase("String_Node_Str"))     continue;
    if (files[i].equalsIgnoreCase("String_Node_Str"))     continue;
    if (deployed.contains(files[i]))     continue;
    File dir=new File(appBase,files[i]);
    if (files[i].toLowerCase(Locale.ENGLISH).endsWith("String_Node_Str") && dir.isFile() && !invalidWars.contains(files[i])) {
      deployed.add(files[i]);
      String contextPath="String_Node_Str" + files[i];
      int period=contextPath.lastIndexOf("String_Node_Str");
      if (period >= 0)       contextPath=contextPath.substring(0,period);
      if (!validateContextPath(appBase,contextPath)) {
        log.severe(sm.getString("String_Node_Str",files[i]));
        invalidWars.add(files[i]);
        continue;
      }
      if (contextPath.equals("String_Node_Str"))       contextPath="String_Node_Str";
      if (host.findChild(contextPath) != null)       continue;
      JarFile jar=null;
      JarEntry entry=null;
      InputStream istream=null;
      BufferedOutputStream ostream=null;
      File xml=new File(configBase,files[i].substring(0,files[i].lastIndexOf("String_Node_Str")) + "String_Node_Str");
      if (!xml.exists()) {
        try {
          jar=new JarFile(dir);
          entry=jar.getJarEntry("String_Node_Str");
          if (entry != null) {
            istream=jar.getInputStream(entry);
            ostream=new BufferedOutputStream(new FileOutputStream(xml),1024);
            byte buffer[]=new byte[1024];
            while (true) {
              int n=istream.read(buffer);
              if (n < 0) {
                break;
              }
              ostream.write(buffer,0,n);
            }
            ostream.flush();
            ostream.close();
            ostream=null;
            istream.close();
            istream=null;
            entry=null;
            jar.close();
            jar=null;
            deployDescriptors(configBase(),configBase.list());
            return;
          }
        }
 catch (        IOException e) {
        }
 finally {
          if (ostream != null) {
            try {
              ostream.close();
            }
 catch (            Throwable t) {
              ;
            }
            ostream=null;
          }
          if (istream != null) {
            try {
              istream.close();
            }
 catch (            Throwable t) {
              ;
            }
            istream=null;
          }
          entry=null;
          if (jar != null) {
            try {
              jar.close();
            }
 catch (            Throwable t) {
              ;
            }
            jar=null;
          }
        }
      }
      if (isUnpackWARs()) {
        if (log.isLoggable(Level.FINE)) {
          log.fine(sm.getString("String_Node_Str",files[i]));
        }
        URL url=null;
        String path=null;
        try {
          url=new URL("String_Node_Str" + dir.getCanonicalPath() + "String_Node_Str");
          path=ExpandWar.expand(host,url);
        }
 catch (        IOException e) {
          log.warning(sm.getString("String_Node_Str",files[i]));
          continue;
        }
catch (        Throwable t) {
          log.log(Level.SEVERE,sm.getString("String_Node_Str",files[i]),t);
          continue;
        }
        try {
          if (path != null) {
            url=new URL("String_Node_Str" + path);
            ((Deployer)host).install(contextPath,url);
          }
        }
 catch (        Throwable t) {
          log.log(Level.SEVERE,sm.getString("String_Node_Str",files[i]),t);
        }
      }
 else {
        if (log.isLoggable(Level.INFO)) {
          log.info(sm.getString("String_Node_Str",files[i]));
        }
        try {
          URL url=new URL("String_Node_Str",null,dir.getCanonicalPath());
          url=new URL("String_Node_Str" + url.toString() + "String_Node_Str");
          ((Deployer)host).install(contextPath,url);
        }
 catch (        Throwable t) {
          log.log(Level.SEVERE,sm.getString("String_Node_Str",files[i]),t);
        }
      }
    }
  }
}