Program: 29419
Project: 29419
Buggy source:
/** 
 * Compare descriptor at given scope is valid and unique.
 * @return
 */
private boolean compareDescriptors(){
  final String JNDI_COMP="String_Node_Str";
  final String JNDI_MODULE="String_Node_Str";
  final String JNDI_APP="String_Node_Str";
  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 {
          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;
}