Program: 30097
Project: 30097
Buggy source:
/** 
 * Parses static domain.xml of all domains to determine if a node is configured for use.
 * @param host remote host
 * @return true|false
 */
boolean checkIfNodeExistsForHost(String host,String iDir){
  boolean result=false;
  try {
    File domainsDirFile=DomainDirs.getDefaultDomainsDir();
    File[] files=domainsDirFile.listFiles(new FileFilter(){
      public boolean accept(      File f){
        return f.isDirectory();
      }
    }
);
    if (files == null || files.length == 0)     return false;
    for (    File file : files) {
      DomainDirs dir=new DomainDirs(file);
      File domainXMLFile=dir.getServerDirs().getDomainXml();
      logger.finer("String_Node_Str" + domainXMLFile);
      try {
        ArrayList<URL> urls=new ArrayList<URL>();
        File idir=new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
        File mdir=new File(idir,"String_Node_Str");
        for (        File f : mdir.listFiles()) {
          if (f.toString().endsWith("String_Node_Str")) {
            urls.add(f.toURI().toURL());
          }
        }
        URL[] urlsA=urls.toArray(new URL[0]);
        ClassLoader cl=new URLClassLoader(urlsA,Globals.class.getClassLoader());
        ModulesRegistry registry=new StaticModulesRegistry(cl);
        Habitat habitat=registry.createHabitat("String_Node_Str");
        ConfigParser parser=new ConfigParser(habitat);
        URL domainURL=domainXMLFile.toURI().toURL();
        DomDocument doc=parser.parse(domainURL);
        Dom domDomain=doc.getRoot();
        Domain domain=domDomain.createProxy(Domain.class);
        Nodes nodes=domain.getNodes();
        for (        Node node : nodes.getNode()) {
          iDir=removeTrailingSlash(iDir.replaceAll("String_Node_Str","String_Node_Str"));
          String d=removeTrailingSlash(node.getInstallDirUnixStyle());
          if ((NetUtils.isEqual(node.getNodeHost(),host) || NetUtils.isThisHostLocal(host)) && d.equals(iDir)) {
            result=true;
          }
        }
      }
 catch (      Exception e) {
        if (logger.isLoggable(Level.FINE)) {
          e.printStackTrace();
        }
      }
    }
  }
 catch (  IOException ioe) {
    if (logger.isLoggable(Level.FINE)) {
      ioe.printStackTrace();
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Parses static domain.xml of all domains to determine if a node is configured for use.
 * @param host remote host
 * @return true|false
 */
boolean checkIfNodeExistsForHost(String host,String iDir){
  boolean result=false;
  try {
    File domainsDirFile=DomainDirs.getDefaultDomainsDir();
    File[] files=domainsDirFile.listFiles(new FileFilter(){
      public boolean accept(      File f){
        return f.isDirectory();
      }
    }
);
    if (files == null || files.length == 0)     return false;
    for (    File file : files) {
      DomainDirs dir=new DomainDirs(file);
      File domainXMLFile=dir.getServerDirs().getDomainXml();
      logger.finer("String_Node_Str" + domainXMLFile);
      try {
        ArrayList<URL> urls=new ArrayList<URL>();
        File idir=new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
        File mdir=new File(idir,"String_Node_Str");
        for (        File f : mdir.listFiles()) {
          if (f.toString().endsWith("String_Node_Str")) {
            urls.add(f.toURI().toURL());
          }
        }
        final URL[] urlsA=urls.toArray(new URL[urls.size()]);
        ClassLoader cl=(ClassLoader)AccessController.doPrivileged(new PrivilegedAction(){
          @Override public Object run(){
            return new URLClassLoader(urlsA,Globals.class.getClassLoader());
          }
        }
);
        ModulesRegistry registry=new StaticModulesRegistry(cl);
        Habitat habitat=registry.createHabitat("String_Node_Str");
        ConfigParser parser=new ConfigParser(habitat);
        URL domainURL=domainXMLFile.toURI().toURL();
        DomDocument doc=parser.parse(domainURL);
        Dom domDomain=doc.getRoot();
        Domain domain=domDomain.createProxy(Domain.class);
        Nodes nodes=domain.getNodes();
        for (        Node node : nodes.getNode()) {
          iDir=removeTrailingSlash(iDir.replaceAll("String_Node_Str","String_Node_Str"));
          String d=removeTrailingSlash(node.getInstallDirUnixStyle());
          if ((NetUtils.isEqual(node.getNodeHost(),host) || NetUtils.isThisHostLocal(host)) && d.equals(iDir)) {
            result=true;
          }
        }
      }
 catch (      Exception e) {
        if (logger.isLoggable(Level.FINE)) {
          e.printStackTrace();
        }
      }
    }
  }
 catch (  IOException ioe) {
    if (logger.isLoggable(Level.FINE)) {
      ioe.printStackTrace();
    }
  }
  return result;
}