Program: 29051
Project: 29051
Buggy source:
private void populate(Collection<com.sun.enterprise.deployment.EjbDescriptor> ejbs){
  try {
    if (archive.exists(WEB_INF_BEANS_XML) || archive.exists(WEB_INF_CLASSES_META_INF_BEANS_XML)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI() + "String_Node_Str"+ WEB_INF_BEANS_XML+ "String_Node_Str"+ WEB_INF_CLASSES_META_INF_BEANS_XML);
      bdaType=BDAType.WAR;
      Enumeration<String> entries=archive.entries();
      while (entries.hasMoreElements()) {
        String entry=entries.nextElement();
        if (legalClassName(entry)) {
          if (entry.contains(WEB_INF_CLASSES)) {
            entry=entry.substring(WEB_INF_CLASSES.length() + 1);
          }
          String className=filenameToClassname(entry);
          try {
            beanClasses.add(getClassLoader().loadClass(className));
            moduleClasses.add(getClassLoader().loadClass(className));
          }
 catch (          Throwable t) {
            logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str" + className + "String_Node_Str"+ t.toString());
          }
        }
 else         if (entry.endsWith(BEANS_XML_FILENAME)) {
          URI uri=archive.getURI();
          File file=new File(uri.getPath() + entry);
          URI beansXmlUri=file.toURI();
          wUris.add(beansXmlUri);
        }
      }
      archive.close();
    }
    if (archive.exists(WEB_INF_LIB)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI());
      bdaType=BDAType.WAR;
      Enumeration<String> entries=archive.entries(WEB_INF_LIB);
      List<ReadableArchive> weblibJarsThatAreBeanArchives=new ArrayList<ReadableArchive>();
      while (entries.hasMoreElements()) {
        String entry=(String)entries.nextElement();
        if (entry.endsWith(JAR_SUFFIX) && entry.indexOf(SEPARATOR_CHAR,WEB_INF_LIB.length() + 1) == -1) {
          ReadableArchive weblibJarArchive=archive.getSubArchive(entry);
          if (weblibJarArchive.exists(META_INF_BEANS_XML)) {
            logger.log(FINE,"String_Node_Str" + entry + "String_Node_Str");
            weblibJarsThatAreBeanArchives.add(weblibJarArchive);
          }
 else           if (weblibJarArchive.exists(META_INF_SERVICES_EXTENSION)) {
            logger.log(FINE,"String_Node_Str" + entry + "String_Node_Str");
            weblibJarsThatAreBeanArchives.add(weblibJarArchive);
          }
 else {
            logger.log(FINE,"String_Node_Str" + archive.getName() + "String_Node_Str");
          }
        }
      }
      List<BeanDeploymentArchiveImpl> webLibBDAs=new ArrayList<BeanDeploymentArchiveImpl>();
      if (weblibJarsThatAreBeanArchives.size() > 0) {
        ListIterator<ReadableArchive> libJarIterator=weblibJarsThatAreBeanArchives.listIterator();
        while (libJarIterator.hasNext()) {
          ReadableArchive libJarArchive=(ReadableArchive)libJarIterator.next();
          BeanDeploymentArchiveImpl wlbda=new BeanDeploymentArchiveImpl(libJarArchive,ejbs,context,WEB_INF_LIB + SEPARATOR_CHAR + libJarArchive.getName());
          this.beanDeploymentArchives.add(wlbda);
          webLibBDAs.add(wlbda);
        }
      }
      ensureWebLibJarVisibility(webLibBDAs);
    }
    if (archive.getName().endsWith(RAR_SUFFIX) || archive.getName().endsWith(EXPANDED_RAR_SUFFIX)) {
      collectRarInfo(archive);
    }
    if (archive.exists(META_INF_BEANS_XML)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI() + "String_Node_Str");
      bdaType=BDAType.JAR;
      collectJarInfo(archive,true);
    }
    if (archive.exists(META_INF_SERVICES_EXTENSION)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI() + "String_Node_Str");
      bdaType=BDAType.UNKNOWN;
      collectJarInfo(archive,false);
    }
  }
 catch (  IOException e) {
    logger.log(SEVERE,e.getLocalizedMessage(),e);
  }
catch (  ClassNotFoundException cne) {
    logger.log(SEVERE,cne.getLocalizedMessage(),cne);
  }
}

Fixed version (ground truth):
private void populate(Collection<com.sun.enterprise.deployment.EjbDescriptor> ejbs){
  try {
    if (archive.exists(WEB_INF_BEANS_XML) || archive.exists(WEB_INF_CLASSES_META_INF_BEANS_XML)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI() + "String_Node_Str"+ WEB_INF_BEANS_XML+ "String_Node_Str"+ WEB_INF_CLASSES_META_INF_BEANS_XML);
      bdaType=BDAType.WAR;
      Enumeration<String> entries=archive.entries();
      while (entries.hasMoreElements()) {
        String entry=entries.nextElement();
        if (legalClassName(entry)) {
          if (entry.contains(WEB_INF_CLASSES)) {
            entry=entry.substring(WEB_INF_CLASSES.length() + 1);
          }
          String className=filenameToClassname(entry);
          try {
            beanClasses.add(getClassLoader().loadClass(className));
            moduleClasses.add(getClassLoader().loadClass(className));
          }
 catch (          Throwable t) {
            logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str" + className + "String_Node_Str"+ t.toString());
          }
        }
 else         if (entry.endsWith(BEANS_XML_FILENAME)) {
          URI uri=archive.getURI();
          File file=new File(uri.getPath() + entry);
          beansXmlUrLs.add(file.toURI().toURL());
        }
      }
      archive.close();
    }
    if (archive.exists(WEB_INF_LIB)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI());
      bdaType=BDAType.WAR;
      Enumeration<String> entries=archive.entries(WEB_INF_LIB);
      List<ReadableArchive> weblibJarsThatAreBeanArchives=new ArrayList<ReadableArchive>();
      while (entries.hasMoreElements()) {
        String entry=(String)entries.nextElement();
        if (entry.endsWith(JAR_SUFFIX) && entry.indexOf(SEPARATOR_CHAR,WEB_INF_LIB.length() + 1) == -1) {
          ReadableArchive weblibJarArchive=archive.getSubArchive(entry);
          if (weblibJarArchive.exists(META_INF_BEANS_XML)) {
            logger.log(FINE,"String_Node_Str" + entry + "String_Node_Str");
            weblibJarsThatAreBeanArchives.add(weblibJarArchive);
          }
 else           if (weblibJarArchive.exists(META_INF_SERVICES_EXTENSION)) {
            logger.log(FINE,"String_Node_Str" + entry + "String_Node_Str");
            weblibJarsThatAreBeanArchives.add(weblibJarArchive);
          }
 else {
            logger.log(FINE,"String_Node_Str" + archive.getName() + "String_Node_Str");
          }
        }
      }
      List<BeanDeploymentArchiveImpl> webLibBDAs=new ArrayList<BeanDeploymentArchiveImpl>();
      if (weblibJarsThatAreBeanArchives.size() > 0) {
        ListIterator<ReadableArchive> libJarIterator=weblibJarsThatAreBeanArchives.listIterator();
        while (libJarIterator.hasNext()) {
          ReadableArchive libJarArchive=(ReadableArchive)libJarIterator.next();
          BeanDeploymentArchiveImpl wlbda=new BeanDeploymentArchiveImpl(libJarArchive,ejbs,context,WEB_INF_LIB + SEPARATOR_CHAR + libJarArchive.getName());
          this.beanDeploymentArchives.add(wlbda);
          webLibBDAs.add(wlbda);
        }
      }
      ensureWebLibJarVisibility(webLibBDAs);
    }
    if (archive.getName().endsWith(RAR_SUFFIX) || archive.getName().endsWith(EXPANDED_RAR_SUFFIX)) {
      collectRarInfo(archive);
    }
    if (archive.exists(META_INF_BEANS_XML)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI() + "String_Node_Str");
      bdaType=BDAType.JAR;
      collectJarInfo(archive,true);
    }
    if (archive.exists(META_INF_SERVICES_EXTENSION)) {
      logger.log(FINE,"String_Node_Str" + archive.getURI() + "String_Node_Str");
      bdaType=BDAType.UNKNOWN;
      collectJarInfo(archive,false);
    }
  }
 catch (  IOException e) {
    logger.log(SEVERE,e.getLocalizedMessage(),e);
  }
catch (  ClassNotFoundException cne) {
    logger.log(SEVERE,cne.getLocalizedMessage(),cne);
  }
}