Program: 34683
Project: 34683
Buggy source:
/** 
 * Create an Entity object corresponding to the LdapEntry object returned by the LdapConnection object.
 * @param parentDO
 * @param propName
 * @param ldapEntry
 * @param propNames
 * @return
 * @throws WIMException
 */
private Entity createEntityFromLdapEntry(Object parentDO,String propName,LdapEntry ldapEntry,List<String> propNames) throws WIMException {
  String outEntityType=ldapEntry.getType();
  Entity outEntity=null;
  if (outEntityType != null) {
    if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_PERSON))     outEntity=new Person();
 else     if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_PERSON_ACCOUNT))     outEntity=new PersonAccount();
 else     if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_GROUP))     outEntity=new Group();
 else     outEntity=new Entity();
  }
 else {
    outEntity=new Entity();
  }
  if (parentDO instanceof Root) {
    if (SchemaConstants.DO_ENTITIES.equalsIgnoreCase(propName))     ((Root)parentDO).getEntities().add(outEntity);
  }
 else   if (parentDO instanceof Entity) {
    if (SchemaConstants.DO_GROUP.equalsIgnoreCase(propName))     ((Entity)parentDO).getGroups().add((Group)outEntity);
    if (SchemaConstants.DO_MEMBERS.equalsIgnoreCase(propName))     ((Group)parentDO).getMembers().add(outEntity);
    if (SchemaConstants.DO_CHILDREN.equalsIgnoreCase(propName))     ((Entity)parentDO).getChildren().add(outEntity);
  }
  IdentifierType outId=new IdentifierType();
  outEntity.setIdentifier(outId);
  outId.setUniqueName(ldapEntry.getUniqueName());
  outId.setExternalId(ldapEntry.getExtId());
  outId.setExternalName(ldapEntry.getDN());
  outId.setRepositoryId(reposId);
  String changeType=ldapEntry.getChangeType();
  if (changeType != null) {
    outEntity.setChangeType(changeType);
    if (SchemaConstants.CHANGETYPE_DELETE.equals(changeType) == false) {
      populateEntity(outEntity,propNames,ldapEntry.getAttributes());
    }
  }
 else {
    populateEntity(outEntity,propNames,ldapEntry.getAttributes());
  }
  return outEntity;
}

Fixed version (ground truth):
/** 
 * Create an Entity object corresponding to the LdapEntry object returned by the LdapConnection object.
 * @param parentDO
 * @param propName
 * @param ldapEntry
 * @param propNames
 * @return
 * @throws WIMException
 */
private Entity createEntityFromLdapEntry(Object parentDO,String propName,LdapEntry ldapEntry,List<String> propNames) throws WIMException {
  final String METHODNAME="String_Node_Str";
  String outEntityType=ldapEntry.getType();
  Entity outEntity=null;
  if (outEntityType != null) {
    if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_PERSON))     outEntity=new Person();
 else     if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_PERSON_ACCOUNT))     outEntity=new PersonAccount();
 else     if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_GROUP))     outEntity=new Group();
 else     outEntity=new Entity();
  }
 else {
    outEntity=new Entity();
  }
  if (parentDO instanceof Root) {
    if (SchemaConstants.DO_ENTITIES.equalsIgnoreCase(propName))     ((Root)parentDO).getEntities().add(outEntity);
  }
 else   if (parentDO instanceof Entity) {
    if (SchemaConstants.DO_GROUP.equalsIgnoreCase(propName)) {
      if (outEntity instanceof Group) {
        ((Entity)parentDO).getGroups().add((Group)outEntity);
      }
 else {
        if (tc.isDebugEnabled()) {
          Tr.debug(tc,METHODNAME + "String_Node_Str" + outEntity);
        }
      }
    }
 else     if (SchemaConstants.DO_MEMBERS.equalsIgnoreCase(propName)) {
      ((Group)parentDO).getMembers().add(outEntity);
    }
 else     if (SchemaConstants.DO_CHILDREN.equalsIgnoreCase(propName)) {
      ((Entity)parentDO).getChildren().add(outEntity);
    }
  }
  IdentifierType outId=new IdentifierType();
  outEntity.setIdentifier(outId);
  outId.setUniqueName(ldapEntry.getUniqueName());
  outId.setExternalId(ldapEntry.getExtId());
  outId.setExternalName(ldapEntry.getDN());
  outId.setRepositoryId(reposId);
  String changeType=ldapEntry.getChangeType();
  if (changeType != null) {
    outEntity.setChangeType(changeType);
    if (SchemaConstants.CHANGETYPE_DELETE.equals(changeType) == false) {
      populateEntity(outEntity,propNames,ldapEntry.getAttributes());
    }
  }
 else {
    populateEntity(outEntity,propNames,ldapEntry.getAttributes());
  }
  return outEntity;
}