Program: 86052
Project: 86052
Buggy source:
@RolesAllowed("String_Node_Str") @Override public PartUsageLink filterProductStructure(ConfigurationItemKey pKey,ConfigSpec configSpec,Integer partUsageLink,Integer depth) throws ConfigurationItemNotFoundException, WorkspaceNotFoundException, NotAllowedException, UserNotFoundException, UserNotActiveException, PartUsageLinkNotFoundException {
  User user=userManager.checkWorkspaceReadAccess(pKey.getWorkspace());
  PartUsageLink rootUsageLink;
  if (partUsageLink == null || partUsageLink == -1) {
    ConfigurationItem ci=new ConfigurationItemDAO(new Locale(user.getLanguage()),em).loadConfigurationItem(pKey);
    rootUsageLink=new PartUsageLink();
    rootUsageLink.setId(-1);
    rootUsageLink.setAmount(1d);
    List<CADInstance> cads=new ArrayList<CADInstance>();
    cads.add(new CADInstance(0d,0d,0d,0d,0d,0d,CADInstance.Positioning.ABSOLUTE));
    rootUsageLink.setCadInstances(cads);
    rootUsageLink.setComponent(ci.getDesignItem());
  }
 else {
    rootUsageLink=new PartUsageLinkDAO(new Locale(user.getLanguage()),em).loadPartUsageLink(partUsageLink);
  }
  if (configSpec instanceof LatestConfigSpec) {
    if (depth == null) {
      filterLatestConfigSpec(rootUsageLink.getComponent(),-1);
    }
 else {
      filterLatestConfigSpec(rootUsageLink.getComponent(),depth);
    }
  }
 else   if (configSpec instanceof BaselineConfigSpec) {
    if (depth == null) {
      filterBaselineConfigSpec(((BaselineConfigSpec)configSpec).getBaseline(),rootUsageLink.getComponent(),-1);
    }
 else {
      filterBaselineConfigSpec(((BaselineConfigSpec)configSpec).getBaseline(),rootUsageLink.getComponent(),depth);
    }
  }
  return rootUsageLink;
}

Fixed version (ground truth):
@RolesAllowed("String_Node_Str") @Override public PartUsageLink filterProductStructure(ConfigurationItemKey pKey,ConfigSpec configSpec,Integer partUsageLink,Integer depth) throws ConfigurationItemNotFoundException, WorkspaceNotFoundException, NotAllowedException, UserNotFoundException, UserNotActiveException, PartUsageLinkNotFoundException {
  User user=userManager.checkWorkspaceReadAccess(pKey.getWorkspace());
  PartUsageLink rootUsageLink;
  if (partUsageLink == null || partUsageLink == -1) {
    ConfigurationItem ci=new ConfigurationItemDAO(new Locale(user.getLanguage()),em).loadConfigurationItem(pKey);
    rootUsageLink=new PartUsageLink();
    rootUsageLink.setId(-1);
    rootUsageLink.setAmount(1d);
    List<CADInstance> cads=new ArrayList<CADInstance>();
    CADInstance cad=new CADInstance(0d,0d,0d,0d,0d,0d,CADInstance.Positioning.ABSOLUTE);
    cad.setId(-1);
    cads.add(cad);
    rootUsageLink.setCadInstances(cads);
    rootUsageLink.setComponent(ci.getDesignItem());
  }
 else {
    rootUsageLink=new PartUsageLinkDAO(new Locale(user.getLanguage()),em).loadPartUsageLink(partUsageLink);
  }
  if (configSpec instanceof LatestConfigSpec) {
    if (depth == null) {
      filterLatestConfigSpec(rootUsageLink.getComponent(),-1);
    }
 else {
      filterLatestConfigSpec(rootUsageLink.getComponent(),depth);
    }
  }
 else   if (configSpec instanceof BaselineConfigSpec) {
    if (depth == null) {
      filterBaselineConfigSpec(((BaselineConfigSpec)configSpec).getBaseline(),rootUsageLink.getComponent(),-1);
    }
 else {
      filterBaselineConfigSpec(((BaselineConfigSpec)configSpec).getBaseline(),rootUsageLink.getComponent(),depth);
    }
  }
  return rootUsageLink;
}