Program: 97601
Project: 97601
Buggy source:
public void load() throws OseeCoreException {
  Artifact teamDefArt=getArtifact();
  if (teamDefArt != null) {
    IAtsTeamDefinition teamDef=TeamDefinitionFactory.getOrCreate(teamDefArt.getGuid(),teamDefArt.getName());
    teamDef.setHumanReadableId(teamDefArt.getHumanReadableId());
    teamDef.setName(teamDefArt.getName());
    atsObject=teamDef;
    teamDef.setActive(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.Active,true));
    teamDef.setActionable(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.Actionable,true));
    teamDef.setTeamUsesVersions(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.TeamUsesVersions,true));
    teamDef.setAllowCommitBranch(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.AllowCommitBranch,true));
    teamDef.setAllowCreateBranch(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.AllowCreateBranch,true));
    String baselineBranchGuid=teamDefArt.getSoleAttributeValue(AtsAttributeTypes.BaselineBranchGuid,"String_Node_Str");
    if (Strings.isValid(baselineBranchGuid)) {
      teamDef.setBaselineBranchGuid(baselineBranchGuid);
    }
    String workflowDefinition=teamDefArt.getSoleAttributeValue(AtsAttributeTypes.WorkflowDefinition,"String_Node_Str");
    if (Strings.isValid(workflowDefinition)) {
      teamDef.setWorkflowDefinition(workflowDefinition);
    }
    String relatedTaskWorkDefinition=teamDefArt.getSoleAttributeValue(AtsAttributeTypes.RelatedTaskWorkDefinition,"String_Node_Str");
    if (Strings.isValid(relatedTaskWorkDefinition)) {
      teamDef.setRelatedTaskWorkDefinition(relatedTaskWorkDefinition);
    }
    teamDef.setDescription(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.Description,"String_Node_Str"));
    teamDef.setFullName(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.FullName,"String_Node_Str"));
    for (    Artifact aiArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamActionableItem_ActionableItem)) {
      IAtsActionableItem ai=ActionableItemFactory.getOrCreate(aiArt.getGuid(),aiArt.getName());
      teamDef.getActionableItems().add(ai);
      ai.setTeamDefinition(teamDef);
    }
    for (    Artifact child : teamDefArt.getChildren()) {
      if (child.isOfType(AtsArtifactTypes.TeamDefinition)) {
        IAtsTeamDefinition childTeamDef=TeamDefinitionFactory.getOrCreate(child.getGuid(),child.getName());
        teamDef.getChildrenTeamDefinitions().add(childTeamDef);
        childTeamDef.setParentTeamDef(teamDef);
      }
    }
    for (    Artifact verArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamDefinitionToVersion_Version)) {
      IAtsVersion version=VersionFactory.getOrCreate(verArt.getGuid(),verArt.getName());
      teamDef.getVersions().add(version);
      AtsVersionService.get().setTeamDefinition(version,teamDef);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getSubscribed().add(user);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamLead_Lead)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getLeads().add(user);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamMember_Member)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getMembers().add(user);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.PrivilegedMember_Member)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getPrivilegedMembers().add(user);
    }
    for (    String ruleStr : teamDefArt.getAttributesToStringList(AtsAttributeTypes.RuleDefinition)) {
      teamDef.addRule(ruleStr);
    }
    for (    String staticId : teamDefArt.getAttributesToStringList(CoreAttributeTypes.StaticId)) {
      teamDef.getStaticIds().add(staticId);
    }
    Artifact parentTeamDefArt=teamDefArt.getParent();
    if (parentTeamDefArt != null && parentTeamDefArt.isOfType(AtsArtifactTypes.TeamDefinition)) {
      IAtsTeamDefinition parentTeamDef=TeamDefinitionFactory.getOrCreate(parentTeamDefArt.getGuid(),parentTeamDefArt.getName());
      teamDef.setParentTeamDef(parentTeamDef);
      parentTeamDef.getChildrenTeamDefinitions().add(teamDef);
    }
  }
}

Fixed version (ground truth):
public void load() throws OseeCoreException {
  Artifact teamDefArt=getArtifact();
  if (teamDefArt != null) {
    IAtsTeamDefinition teamDef=TeamDefinitionFactory.getOrCreate(teamDefArt.getGuid(),teamDefArt.getName());
    teamDef.setHumanReadableId(teamDefArt.getHumanReadableId());
    teamDef.setName(teamDefArt.getName());
    atsObject=teamDef;
    teamDef.setActive(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.Active,false));
    teamDef.setActionable(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.Actionable,false));
    teamDef.setTeamUsesVersions(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.TeamUsesVersions,false));
    teamDef.setAllowCommitBranch(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.AllowCommitBranch,false));
    teamDef.setAllowCreateBranch(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.AllowCreateBranch,false));
    String baselineBranchGuid=teamDefArt.getSoleAttributeValue(AtsAttributeTypes.BaselineBranchGuid,"String_Node_Str");
    if (Strings.isValid(baselineBranchGuid)) {
      teamDef.setBaselineBranchGuid(baselineBranchGuid);
    }
    String workflowDefinition=teamDefArt.getSoleAttributeValue(AtsAttributeTypes.WorkflowDefinition,"String_Node_Str");
    if (Strings.isValid(workflowDefinition)) {
      teamDef.setWorkflowDefinition(workflowDefinition);
    }
    String relatedTaskWorkDefinition=teamDefArt.getSoleAttributeValue(AtsAttributeTypes.RelatedTaskWorkDefinition,"String_Node_Str");
    if (Strings.isValid(relatedTaskWorkDefinition)) {
      teamDef.setRelatedTaskWorkDefinition(relatedTaskWorkDefinition);
    }
    teamDef.setDescription(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.Description,"String_Node_Str"));
    teamDef.setFullName(teamDefArt.getSoleAttributeValue(AtsAttributeTypes.FullName,"String_Node_Str"));
    for (    Artifact aiArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamActionableItem_ActionableItem)) {
      IAtsActionableItem ai=ActionableItemFactory.getOrCreate(aiArt.getGuid(),aiArt.getName());
      teamDef.getActionableItems().add(ai);
      ai.setTeamDefinition(teamDef);
    }
    for (    Artifact child : teamDefArt.getChildren()) {
      if (child.isOfType(AtsArtifactTypes.TeamDefinition)) {
        IAtsTeamDefinition childTeamDef=TeamDefinitionFactory.getOrCreate(child.getGuid(),child.getName());
        teamDef.getChildrenTeamDefinitions().add(childTeamDef);
        childTeamDef.setParentTeamDef(teamDef);
      }
    }
    for (    Artifact verArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamDefinitionToVersion_Version)) {
      IAtsVersion version=VersionFactory.getOrCreate(verArt.getGuid(),verArt.getName());
      teamDef.getVersions().add(version);
      AtsVersionService.get().setTeamDefinition(version,teamDef);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getSubscribed().add(user);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamLead_Lead)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getLeads().add(user);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.TeamMember_Member)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getMembers().add(user);
    }
    for (    Artifact userArt : teamDefArt.getRelatedArtifacts(AtsRelationTypes.PrivilegedMember_Member)) {
      IAtsUser user=AtsUsersClient.getUserFromOseeUser((User)userArt);
      teamDef.getPrivilegedMembers().add(user);
    }
    for (    String ruleStr : teamDefArt.getAttributesToStringList(AtsAttributeTypes.RuleDefinition)) {
      teamDef.addRule(ruleStr);
    }
    for (    String staticId : teamDefArt.getAttributesToStringList(CoreAttributeTypes.StaticId)) {
      teamDef.getStaticIds().add(staticId);
    }
    Artifact parentTeamDefArt=teamDefArt.getParent();
    if (parentTeamDefArt != null && parentTeamDefArt.isOfType(AtsArtifactTypes.TeamDefinition)) {
      IAtsTeamDefinition parentTeamDef=TeamDefinitionFactory.getOrCreate(parentTeamDefArt.getGuid(),parentTeamDefArt.getName());
      teamDef.setParentTeamDef(parentTeamDef);
      parentTeamDef.getChildrenTeamDefinitions().add(teamDef);
    }
  }
}