Program: 28179
Project: 28179
Buggy source:
/** 
 * Compare descriptor at given scope is valid and unique.
 * @return
 */
private boolean compareDescriptors(){
  Vector appVectorName=validNameSpaceDetails.get(APP_KEYS);
  Vector ebdVectorName=validNameSpaceDetails.get(EJBBUNDLE_KEYS);
  for (  String key : allResourceDescriptors.keySet()) {
    CommonResourceValidator commonResourceValidator=allResourceDescriptors.get(key);
    Vector scopeVector=commonResourceValidator.getScope();
    String jndiName=commonResourceValidator.getJndiName();
    if (jndiName.contains(JNDI_COMP)) {
      for (int i=0; i < scopeVector.size(); i++) {
        String scope=(String)scopeVector.get(i);
        for (int j=0; j < appVectorName.size(); j++) {
          if (scope.equals(appVectorName.get(j))) {
            inValidJndiName=jndiName;
            DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
            return false;
          }
        }
        for (int j=0; j < ebdVectorName.size(); j++) {
          if (scope.equals(ebdVectorName.get(j))) {
            inValidJndiName=jndiName;
            DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
            return false;
          }
        }
      }
    }
    if (jndiName.contains(JNDI_MODULE)) {
      for (int i=0; i < scopeVector.size(); i++) {
        String scope=(String)scopeVector.get(i);
        for (int j=0; j < appVectorName.size(); j++) {
          if (scope.equals(appVectorName.get(j))) {
            inValidJndiName=jndiName;
            DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
            return false;
          }
        }
      }
    }
    if (scopeVector.size() > 1) {
      if (jndiName.contains(JNDI_COMP)) {
        if (!compareVectorForComp(scopeVector,jndiName)) {
          return false;
        }
      }
 else       if (jndiName.contains(JNDI_MODULE)) {
        if (!compareVectorForModule(scopeVector,jndiName)) {
          return false;
        }
      }
 else       if (jndiName.contains(JNDI_APP)) {
        if (!compareVectorForApp(scopeVector,jndiName)) {
          return false;
        }
      }
 else {
        try {
          InitialContext ic=new InitialContext();
          Object lookup=ic.lookup(jndiName);
          if (lookup != null) {
            return false;
          }
        }
 catch (        NamingException e) {
          inValidJndiName=jndiName;
          DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Compare descriptor at given scope is valid and unique.
 * @return
 */
private boolean compareDescriptors(){
  Vector appVectorName=validNameSpaceDetails.get(APP_KEYS);
  Vector ebdVectorName=validNameSpaceDetails.get(EJBBUNDLE_KEYS);
  for (  String key : allResourceDescriptors.keySet()) {
    CommonResourceValidator commonResourceValidator=allResourceDescriptors.get(key);
    Vector scopeVector=commonResourceValidator.getScope();
    String jndiName=commonResourceValidator.getJndiName();
    if (jndiName.contains(JNDI_COMP)) {
      for (int i=0; i < scopeVector.size(); i++) {
        String scope=(String)scopeVector.get(i);
        for (int j=0; j < appVectorName.size(); j++) {
          if (scope.equals(appVectorName.get(j))) {
            inValidJndiName=jndiName;
            DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
            return false;
          }
        }
        for (int j=0; j < ebdVectorName.size(); j++) {
          if (scope.equals(ebdVectorName.get(j))) {
            inValidJndiName=jndiName;
            DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
            return false;
          }
        }
      }
    }
    if (jndiName.contains(JNDI_MODULE)) {
      for (int i=0; i < scopeVector.size(); i++) {
        String scope=(String)scopeVector.get(i);
        for (int j=0; j < appVectorName.size(); j++) {
          if (scope.equals(appVectorName.get(j))) {
            inValidJndiName=jndiName;
            DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
            return false;
          }
        }
      }
    }
    if (scopeVector.size() > 1) {
      if (jndiName.contains(JNDI_COMP)) {
        if (!compareVectorForComp(scopeVector,jndiName)) {
          return false;
        }
      }
 else       if (jndiName.contains(JNDI_MODULE)) {
        if (!compareVectorForModule(scopeVector,jndiName)) {
          return false;
        }
      }
 else       if (jndiName.contains(JNDI_APP)) {
        if (!compareVectorForApp(scopeVector,jndiName)) {
          return false;
        }
      }
 else {
        try {
          boolean selfDefining=((commonResourceValidator.getDescriptor() instanceof JMSDestinationDefinitionDescriptor) || (commonResourceValidator.getDescriptor() instanceof DataSourceDefinitionDescriptor));
          if (!selfDefining) {
            InitialContext ic=new InitialContext();
            Object lookup=ic.lookup(jndiName);
            if (lookup != null) {
              return false;
            }
          }
        }
 catch (        NamingException e) {
          inValidJndiName=jndiName;
          DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName});
        }
      }
    }
  }
  return true;
}