nus-yam/ex-repair huggingface dataset:
Program: 96892
Project: 96892
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON}) public Response getClientsForUser(@PathParam("String_Node_Str") String userId){
  Sessions sessions=new Sessions();
  Map<String,Boolean> portToAlive=new HashMap<>();
  String uId=getUserId(userId);
  if (!Strings.isValid(uId)) {
    throw new OseeArgumentException("String_Node_Str",userId);
  }
  Consumer<JdbcStatement> consumer=stmt -> {
    ClientSession session=createSession(stmt,uriInfo);
    String key=session.getClientAddress() + session.getClientPort();
    Boolean alive=portToAlive.get(key);
    if (alive == null) {
      alive=alive(session);
      portToAlive.put(key,alive);
      if (alive) {
        sessions.add(session);
      }
    }
  }
;
  jdbcService.getClient().runQueryWithLimit(consumer,10,NEWEST_SESSIONS_BY_USER,userId);
  return Response.ok(sessions).build();
}

Fixed version (ground truth):
/** 
 * @param idOrName as userId or name; underscores can be used instead of spaces if calling from browser;
 * @return all client sessions matching idOrName; multiple users sessions can be returned depending
 */
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON}) public Response getClientsForUser(@PathParam("String_Node_Str") String idOrName){
  Sessions sessions=new Sessions();
  Map<String,Boolean> portToAlive=new HashMap<>();
  List<String> resolvedUserIds=getUserIds(idOrName);
  if (resolvedUserIds.isEmpty()) {
    throw new OseeArgumentException("String_Node_Str",idOrName);
  }
  Consumer<JdbcStatement> consumer=stmt -> {
    ClientSession session=createSession(stmt,uriInfo);
    String key=session.getClientAddress() + session.getClientPort();
    Boolean alive=portToAlive.get(key);
    if (alive == null) {
      alive=alive(session);
      portToAlive.put(key,alive);
      if (alive) {
        sessions.add(session);
      }
    }
  }
;
  for (  String userId : resolvedUserIds) {
    jdbcService.getClient().runQueryWithLimit(consumer,10,NEWEST_SESSIONS_BY_USER,userId);
  }
  return Response.ok(sessions).build();
}
Program: 96893
Project: 96893
Buggy source:
private void findMatchForAll(Iterator<DataRightEntry> iterator,Collection<DataRightAnchor> anchors,Map<String,DataRight> classificationsToDataRight){
  DataRightEntry previousArtifact=null;
  while (iterator.hasNext()) {
    DataRightEntry currentArtifact=iterator.next();
    String classification=currentArtifact.getClassification();
    boolean isSetDataRightFooter=false;
    if (previousArtifact == null) {
      isSetDataRightFooter=true;
    }
 else {
      String previousArtClassification=previousArtifact.getClassification();
      if (!classification.equals(previousArtClassification)) {
        isSetDataRightFooter=true;
      }
 else {
        DataRightAnchor previousArtAnchor=getAnchor(previousArtifact.getGuid(),anchors);
        if (previousArtAnchor != null) {
          previousArtAnchor.setContinuous(true);
        }
      }
    }
    if (!Strings.isValid(classification)) {
      classification="String_Node_Str";
    }
    DataRight dataRight=classificationsToDataRight.get(classification);
    if (dataRight == null) {
      classification="String_Node_Str";
      dataRight=classificationsToDataRight.get(classification);
    }
    DataRightAnchor anchor=new DataRightAnchor();
    anchor.setSetDataRightFooter(isSetDataRightFooter);
    anchor.setId(currentArtifact.getGuid());
    anchor.setDataRightId(dataRight.getId());
    anchors.add(anchor);
    previousArtifact=currentArtifact;
  }
}

Fixed version (ground truth):
private void findMatchForAll(Iterator<DataRightEntry> iterator,Collection<DataRightAnchor> anchors,Map<String,DataRight> classificationsToDataRight){
  DataRightEntry previousArtifact=null;
  while (iterator.hasNext()) {
    DataRightEntry currentArtifact=iterator.next();
    String classification=currentArtifact.getClassification();
    PageOrientation orientation=currentArtifact.getOrientation();
    boolean isSetDataRightFooter=false;
    if (previousArtifact == null) {
      isSetDataRightFooter=true;
    }
 else {
      String previousArtClassification=previousArtifact.getClassification();
      if (!classification.equals(previousArtClassification)) {
        isSetDataRightFooter=true;
      }
 else {
        DataRightAnchor previousArtAnchor=getAnchor(previousArtifact.getGuid(),anchors);
        PageOrientation prevOrientation=previousArtifact.getOrientation();
        if (previousArtAnchor != null && orientation.equals(prevOrientation)) {
          previousArtAnchor.setContinuous(true);
        }
      }
    }
    if (!Strings.isValid(classification)) {
      classification="String_Node_Str";
    }
    DataRight dataRight=classificationsToDataRight.get(classification);
    if (dataRight == null) {
      classification="String_Node_Str";
      dataRight=classificationsToDataRight.get(classification);
    }
    DataRightAnchor anchor=new DataRightAnchor();
    anchor.setSetDataRightFooter(isSetDataRightFooter);
    anchor.setId(currentArtifact.getGuid());
    anchor.setDataRightId(dataRight.getId());
    anchors.add(anchor);
    previousArtifact=currentArtifact;
  }
}
Program: 96894
Project: 96894
Buggy source:
default boolean isValid(){
  return !isInvalid();
}

Fixed version (ground truth):
default boolean isValid(){
  return getId().longValue() > 0;
}
Program: 96895
Project: 96895
Buggy source:
default boolean isInvalid(){
  return getId().equals(SENTINEL);
}

Fixed version (ground truth):
default boolean isInvalid(){
  return !isValid();
}
Program: 96896
Project: 96896
Buggy source:
private void populateRequest(List<Artifact> artifacts,DataRightInput request){
  if (request.isEmpty()) {
    List<Artifact> allArtifacts=new ArrayList<>();
    if (recurseChildren) {
      for (      Artifact art : artifacts) {
        allArtifacts.add(art);
        if (!art.isHistorical()) {
          allArtifacts.addAll(art.getDescendants());
        }
      }
    }
 else {
      allArtifacts.addAll(artifacts);
    }
    int index=0;
    String overrideClassification=(String)renderer.getOption(ITemplateRenderer.OVERRIDE_DATA_RIGHTS_OPTION);
    for (    Artifact artifact : allArtifacts) {
      String classification=null;
      if (overrideClassification != null && ITemplateRenderer.DataRightsClassification.isValid(overrideClassification)) {
        classification=overrideClassification;
      }
 else {
        classification=artifact.getSoleAttributeValueAsString(CoreAttributeTypes.DataRightsClassification,"String_Node_Str");
      }
      PageOrientation orientation=WordRendererUtil.getPageOrientation(artifact);
      request.addData(artifact.getGuid(),classification,orientation,index);
      index++;
    }
  }
}

Fixed version (ground truth):
private void populateRequest(List<Artifact> artifacts,DataRightInput request){
  if (request.isEmpty()) {
    List<Artifact> allArtifacts=new ArrayList<>();
    if (recurseChildren || (renderer.getBooleanOption(RECURSE_ON_LOAD) && !renderer.getBooleanOption("String_Node_Str"))) {
      for (      Artifact art : artifacts) {
        allArtifacts.add(art);
        if (!art.isHistorical()) {
          allArtifacts.addAll(art.getDescendants());
        }
      }
    }
 else {
      allArtifacts.addAll(artifacts);
    }
    int index=0;
    String overrideClassification=(String)renderer.getOption(ITemplateRenderer.OVERRIDE_DATA_RIGHTS_OPTION);
    for (    Artifact artifact : allArtifacts) {
      String classification=null;
      if (overrideClassification != null && ITemplateRenderer.DataRightsClassification.isValid(overrideClassification)) {
        classification=overrideClassification;
      }
 else {
        classification=artifact.getSoleAttributeValueAsString(CoreAttributeTypes.DataRightsClassification,"String_Node_Str");
      }
      PageOrientation orientation=WordRendererUtil.getPageOrientation(artifact);
      request.addData(artifact.getGuid(),classification,orientation,index);
      index++;
    }
  }
}
Program: 96897
Project: 96897
Buggy source:
public static Set<Artifact> bulkLoadArtifacts(Collection<? extends Artifact> artifacts) throws OseeCoreException {
  List<Artifact> actions=new ArrayList<>();
  List<Artifact> teams=new ArrayList<>();
  List<Artifact> tasks=new ArrayList<>();
  for (  Artifact art : artifacts) {
    if (IAtsAction.isOfType(art)) {
      actions.add(art);
    }
 else     if (IAtsTeamWorkflow.isOfType(art)) {
      teams.add(art);
    }
 else     if (IAtsTask.isOfType(art)) {
      tasks.add(art);
    }
  }
  Set<Artifact> arts=new HashSet<Artifact>();
  if (!actions.isEmpty()) {
    arts.addAll(RelationManager.getRelatedArtifacts(actions,3,AtsRelationTypes.TeamWfToTask_Task,AtsRelationTypes.TeamWorkflowToReview_Review,AtsRelationTypes.ActionToWorkflow_Action));
  }
  if (!teams.isEmpty()) {
    arts.addAll(RelationManager.getRelatedArtifacts(teams,4,AtsRelationTypes.TeamWfToTask_Task,AtsRelationTypes.ActionToWorkflow_WorkFlow,AtsRelationTypes.TeamWorkflowToReview_Review));
  }
  if (!tasks.isEmpty()) {
    arts.addAll(RelationManager.getRelatedArtifacts(tasks,2,AtsRelationTypes.TeamWfToTask_TeamWf,AtsRelationTypes.ActionToWorkflow_WorkFlow));
  }
  arts.addAll(artifacts);
  System.err.println("String_Node_Str" + arts.size());
  return arts;
}

Fixed version (ground truth):
public static Set<Artifact> bulkLoadArtifacts(Collection<? extends Artifact> artifacts) throws OseeCoreException {
  List<Artifact> actions=new ArrayList<>();
  List<Artifact> teams=new ArrayList<>();
  List<Artifact> tasks=new ArrayList<>();
  for (  Artifact art : artifacts) {
    if (IAtsAction.isOfType(art)) {
      actions.add(art);
    }
 else     if (IAtsTeamWorkflow.isOfType(art)) {
      teams.add(art);
    }
 else     if (IAtsTask.isOfType(art)) {
      tasks.add(art);
    }
  }
  Set<Artifact> arts=new HashSet<Artifact>();
  if (!actions.isEmpty()) {
    arts.addAll(RelationManager.getRelatedArtifacts(actions,3,AtsRelationTypes.TeamWfToTask_Task,AtsRelationTypes.TeamWorkflowToReview_Review,AtsRelationTypes.ActionToWorkflow_Action));
  }
  if (!teams.isEmpty()) {
    arts.addAll(RelationManager.getRelatedArtifacts(teams,4,AtsRelationTypes.TeamWfToTask_Task,AtsRelationTypes.ActionToWorkflow_WorkFlow,AtsRelationTypes.TeamWorkflowToReview_Review));
  }
  if (!tasks.isEmpty()) {
    arts.addAll(RelationManager.getRelatedArtifacts(tasks,2,AtsRelationTypes.TeamWfToTask_TeamWf,AtsRelationTypes.ActionToWorkflow_WorkFlow));
  }
  arts.addAll(artifacts);
  return arts;
}
Program: 96898
Project: 96898
Buggy source:
@Override public Collection<IAtsInsertionActivity> getInput(){
  if (insertionWidget == null || insertionWidget.get() == null) {
    return selectOthers;
  }
  return Collections.castAll(AtsClientService.get().getProgramService().getInsertionActivities(insertionWidget.get()));
}

Fixed version (ground truth):
@Override public Collection<IAtsInsertionActivity> getInput(){
  if (insertionWidget != null && insertionWidget.get() != null) {
    Object obj=insertionWidget.getWidget().getSelected();
    if (obj != null && obj instanceof IAtsInsertion) {
      return Collections.castAll(AtsClientService.get().getProgramService().getInsertionActivities(insertionWidget.get()));
    }
  }
  return java.util.Collections.emptyList();
}
Program: 96899
Project: 96899
Buggy source:
@Override public Collection<IAtsInsertion> getInput(){
  if (programWidget == null || programWidget.get() == null) {
    return selectOthers;
  }
  return Collections.castAll(AtsClientService.get().getProgramService().getInsertions(programWidget.get()));
}

Fixed version (ground truth):
@Override public Collection<IAtsInsertion> getInput(){
  if (programWidget != null && programWidget.get() != null) {
    Object obj=programWidget.getWidget().getSelected();
    if (obj != null && obj instanceof IAtsProgram) {
      return Collections.castAll(AtsClientService.get().getProgramService().getInsertions(programWidget.get()));
    }
  }
  return java.util.Collections.emptyList();
}
Program: 96900
Project: 96900
Buggy source:
private int getPosition(Artifact artifact) throws OseeCoreException {
  Artifact parent=artifact.getParent();
  List<Artifact> children=parent.getChildren();
  strongArtifactRefs.addAll(children);
  for (int index=0; index < children.size(); index++) {
    Artifact child=children.get(index);
    if (artifact.equals(child)) {
      return index + 1;
    }
  }
  throw new OseeStateException("String_Node_Str",artifact,parent);
}

Fixed version (ground truth):
private int getPosition(Artifact artifact) throws OseeCoreException {
  Artifact parent=artifact.getParent();
  List<Artifact> children=parentToChildrenCache.get(parent.getId());
  if (children == null) {
    children=parent.getChildren();
    parentToChildrenCache.put(parent.getId(),children);
  }
  int index=1 + children.indexOf(artifact);
  if (index > 0) {
    return index;
  }
  throw new OseeStateException("String_Node_Str",artifact,parent);
}
Program: 96901
Project: 96901
Buggy source:
public static TransactionToken getTransactionAtDate(BranchId branch,Date maxDateExclusive) throws OseeCoreException {
  Conditions.checkNotNull(branch,"String_Node_Str");
  Conditions.checkNotNull(maxDateExclusive,"String_Node_Str");
  TransactionRecord txRecord=null;
  JdbcStatement chStmt=ConnectionHandler.getStatement();
  try {
    chStmt.runPreparedQuery(SELECT_BRANCH_TRANSACTION_BY_DATE,branch,new Timestamp(maxDateExclusive.getTime()));
    if (chStmt.next()) {
      if (chStmt.wasNull()) {
        DateFormat dateFormat=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG);
        throw new TransactionDoesNotExist("String_Node_Str",dateFormat.format(maxDateExclusive));
      }
      txRecord=loadTransaction(chStmt);
    }
  }
  finally {
    chStmt.close();
  }
  return txRecord;
}

Fixed version (ground truth):
public static TransactionToken getTransactionAtDate(BranchId branch,Date maxDateExclusive) throws OseeCoreException {
  Conditions.checkNotNull(branch,"String_Node_Str");
  Conditions.checkNotNull(maxDateExclusive,"String_Node_Str");
  TransactionRecord txRecord=null;
  JdbcStatement chStmt=ConnectionHandler.getStatement();
  try {
    chStmt.runPreparedQuery(SELECT_BRANCH_TRANSACTION_BY_DATE,branch,new Timestamp(maxDateExclusive.getTime()));
    if (chStmt.next()) {
      txRecord=loadTransaction(chStmt);
    }
  }
  finally {
    chStmt.close();
  }
  return txRecord;
}
Program: 96902
Project: 96902
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (obj instanceof JaxAtsObject) {
    JaxAtsObject other=(JaxAtsObject)obj;
    if (other.getUuid() == uuid) {
      return true;
    }
  }
  if (obj instanceof IAtsObject) {
    IAtsObject other=(IAtsObject)obj;
    if (other.getUuid().equals(uuid)) {
      return true;
    }
  }
  if (obj instanceof ArtifactId) {
    ArtifactId other=(ArtifactId)obj;
    if (other.getUuid().equals(uuid)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (obj instanceof JaxAtsObject) {
    JaxAtsObject other=(JaxAtsObject)obj;
    if (other.getUuid().equals(uuid)) {
      return true;
    }
  }
  if (obj instanceof IAtsObject) {
    IAtsObject other=(IAtsObject)obj;
    if (other.getUuid().equals(uuid)) {
      return true;
    }
  }
  if (obj instanceof ArtifactId) {
    ArtifactId other=(ArtifactId)obj;
    if (other.getUuid().equals(uuid)) {
      return true;
    }
  }
  return false;
}
Program: 96903
Project: 96903
Buggy source:
public static Artifact getAssociatedArtifact(TransactionDelta txDelta) throws OseeCoreException {
  Artifact associatedArtifact=null;
  if (txDelta.areOnTheSameBranch()) {
    Long commitArtId=TransactionManager.getCommitArtId(txDelta.getEndTx());
    if (!commitArtId.equals(0)) {
      associatedArtifact=ArtifactQuery.getArtifactFromId(commitArtId,COMMON);
    }
  }
 else {
    BranchId sourceBranch=txDelta.getStartTx().getBranch();
    associatedArtifact=BranchManager.getAssociatedArtifact(sourceBranch);
  }
  return associatedArtifact;
}

Fixed version (ground truth):
public static Artifact getAssociatedArtifact(TransactionDelta txDelta) throws OseeCoreException {
  Artifact associatedArtifact=null;
  if (txDelta.areOnTheSameBranch()) {
    Long commitArtId=TransactionManager.getCommitArtId(txDelta.getEndTx());
    if (!commitArtId.equals(0L)) {
      associatedArtifact=ArtifactQuery.getArtifactFromId(commitArtId,COMMON);
    }
  }
 else {
    BranchId sourceBranch=txDelta.getStartTx().getBranch();
    associatedArtifact=BranchManager.getAssociatedArtifact(sourceBranch);
  }
  return associatedArtifact;
}
Program: 96904
Project: 96904
Buggy source:
@Override protected void doWork(IProgressMonitor monitor) throws Exception {
  Artifact associatedArtifact=null;
  TransactionDelta txDelta=changeData.getTxDelta();
  if (changeData.getCompareType().areSpecificTxs()) {
    Long commitId=TransactionManager.getCommitArtId(txDelta.getEndTx());
    if (!commitId.equals(0)) {
      associatedArtifact=ArtifactQuery.getArtifactFromId(commitId,COMMON);
    }
  }
 else {
    BranchId sourceBranch=txDelta.getStartTx().getBranch();
    if (!BranchManager.getState(sourceBranch).isDeleted()) {
      associatedArtifact=BranchManager.getAssociatedArtifact(sourceBranch);
    }
  }
  monitor.worked(calculateWork(0.80));
  changeData.setAssociatedArtifact(associatedArtifact);
  monitor.worked(calculateWork(0.20));
}

Fixed version (ground truth):
@Override protected void doWork(IProgressMonitor monitor) throws Exception {
  Artifact associatedArtifact=null;
  TransactionDelta txDelta=changeData.getTxDelta();
  if (changeData.getCompareType().areSpecificTxs()) {
    Long commitId=TransactionManager.getCommitArtId(txDelta.getEndTx());
    if (!commitId.equals(0L)) {
      associatedArtifact=ArtifactQuery.getArtifactFromId(commitId,COMMON);
    }
  }
 else {
    BranchId sourceBranch=txDelta.getStartTx().getBranch();
    if (!BranchManager.getState(sourceBranch).isDeleted()) {
      associatedArtifact=BranchManager.getAssociatedArtifact(sourceBranch);
    }
  }
  monitor.worked(calculateWork(0.80));
  changeData.setAssociatedArtifact(associatedArtifact);
  monitor.worked(calculateWork(0.20));
}
Program: 96905
Project: 96905
Buggy source:
private void handleCreateNewWorkflow(Collection<TeamWorkFlowArtifact> teamArts,String title) throws OseeCoreException {
  IAtsUser user=AtsClientService.get().getUserService().getCurrentUser();
  List<IAtsTeamWorkflow> teamWfs=new LinkedList<>();
  for (  TeamWorkFlowArtifact teamArt : getDefaultTeamWorkflows()) {
    teamWfs.add(teamArt);
  }
  DuplicateWorkflowAtStartStateOperation op=new DuplicateWorkflowAtStartStateOperation(teamWfs,title,user,AtsClientService.get());
  IValidatingOperation operation=op;
  XResultData results=validateAndRun(operation);
  if (!results.isErrors()) {
    for (    IAtsTeamWorkflow newTeamArt : op.getResults().values()) {
      WorkflowEditor.editArtifact(newTeamArt);
    }
  }
}

Fixed version (ground truth):
private void handleCreateNewWorkflow(Collection<TeamWorkFlowArtifact> teamArts,String title) throws OseeCoreException {
  IAtsUser user=AtsClientService.get().getUserService().getCurrentUser();
  List<IAtsTeamWorkflow> teamWfs=new LinkedList<>();
  for (  TeamWorkFlowArtifact teamArt : getDefaultTeamWorkflows()) {
    teamWfs.add(teamArt);
  }
  DuplicateWorkflowAtStartStateOperation op=new DuplicateWorkflowAtStartStateOperation(teamWfs,title,user,AtsClientService.get());
  IValidatingOperation operation=op;
  XResultData results=validateAndRun(operation);
  if (!results.isErrors()) {
    for (    IAtsTeamWorkflow newTeamArt : op.getResults().values()) {
      WorkflowEditor.editArtifact((Artifact)newTeamArt);
    }
  }
}
Program: 96906
Project: 96906
Buggy source:
private void handleCreateDuplicate(Collection<TeamWorkFlowArtifact> teamArts,boolean duplicateTasks,String title) throws OseeCoreException {
  IAtsUser user=AtsClientService.get().getUserService().getCurrentUser();
  List<IAtsTeamWorkflow> teamWfs=new LinkedList<>();
  for (  TeamWorkFlowArtifact teamArt : getDefaultTeamWorkflows()) {
    teamWfs.add(teamArt);
  }
  DuplicateWorkflowAsIsOperation op=new DuplicateWorkflowAsIsOperation(teamWfs,duplicateTasks,title,user,AtsClientService.get());
  IValidatingOperation operation=op;
  XResultData results=validateAndRun(operation);
  if (!results.isErrors()) {
    for (    IAtsTeamWorkflow newTeamArt : op.getResults().values()) {
      SMAEditor.editArtifact((Artifact)newTeamArt);
    }
  }
}

Fixed version (ground truth):
private void handleCreateDuplicate(Collection<TeamWorkFlowArtifact> teamArts,boolean duplicateTasks,String title) throws OseeCoreException {
  IAtsUser user=AtsClientService.get().getUserService().getCurrentUser();
  List<IAtsTeamWorkflow> teamWfs=new LinkedList<>();
  for (  TeamWorkFlowArtifact teamArt : getDefaultTeamWorkflows()) {
    teamWfs.add(teamArt);
  }
  DuplicateWorkflowAsIsOperation op=new DuplicateWorkflowAsIsOperation(teamWfs,duplicateTasks,title,user,AtsClientService.get());
  IValidatingOperation operation=op;
  XResultData results=validateAndRun(operation);
  if (!results.isErrors()) {
    for (    IAtsTeamWorkflow newTeamArt : op.getResults().values()) {
      WorkflowEditor.editArtifact((Artifact)newTeamArt);
    }
  }
}
Program: 96907
Project: 96907
Buggy source:
@Override public void run(){
  flatControl.addPage((T)null);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void run(){
  Object obj=null;
  T object=(T)obj;
  flatControl.addPage(object);
}
Program: 96909
Project: 96909
Buggy source:
/** 
 * @param artifact the artifact to set
 */
public void setArtifact(Artifact artifact){
  if (this.artifact.equals(artifact)) {
    return;
  }
  this.artifact=artifact;
  loadArtTypes();
  loadRelTypes();
  loadAttributeTypes();
  notifyListeners(ModType.Artifact);
}

Fixed version (ground truth):
/** 
 * @param artifact the artifact to set
 */
public void setArtifact(Artifact artifact){
  if (artifact.equals(this.artifact)) {
    return;
  }
  this.artifact=artifact;
  loadArtTypes();
  loadRelTypes();
  loadAttributeTypes();
  notifyListeners(ModType.Artifact);
}
Program: 96910
Project: 96910
Buggy source:
@GET @Produces(MediaType.APPLICATION_JSON) public Response getRoot(){
  URI uri=UriBuilder.fromUri("String_Node_Str").build();
  return Response.seeOther(uri).build();
}

Fixed version (ground truth):
@GET @Produces(MediaType.APPLICATION_JSON) public Response getRoot(){
  String forwardedServer=OAuthUtil.getForwarderServer();
  String basePath;
  URI location=uriInfo.getRequestUri();
  if (Strings.isValid(forwardedServer)) {
    basePath=forwardedServer;
  }
 else {
    basePath=location.toString();
  }
  String scheme=location.getScheme();
  URI finalUri=UriBuilder.fromPath(basePath).scheme(scheme).path("String_Node_Str").fragment(location.getRawFragment()).buildFromEncoded();
  return Response.seeOther(finalUri).build();
}
Program: 96911
Project: 96911
Buggy source:
@Before public void setUp(){
  MockitoAnnotations.initMocks(this);
  factory=new AttributeDataProxyFactory(proxyProvider,attributeTypeCache);
}

Fixed version (ground truth):
@Before public void setUp(){
  MockitoAnnotations.initMocks(this);
  factory=new AttributeDataProxyFactory(proxyProvider,null,attributeTypeCache);
}
Program: 96912
Project: 96912
Buggy source:
public AttributeDataProxyFactory(DataProxyFactoryProvider proxyProvider,AttributeTypes attributeTypes){
  super();
  this.proxyProvider=proxyProvider;
  this.attributeTypeCache=attributeTypes;
}

Fixed version (ground truth):
public AttributeDataProxyFactory(DataProxyFactoryProvider proxyProvider,JdbcClient jdbcClient,AttributeTypes attributeTypes){
  super();
  this.proxyProvider=proxyProvider;
  this.attributeTypeCache=attributeTypes;
  this.jdbcClient=jdbcClient;
}
Program: 96913
Project: 96913
Buggy source:
public ProxyDataFactory createProxyDataFactory(AttributeTypes attributeTypes){
  return new AttributeDataProxyFactory(proxyProvider,attributeTypes);
}

Fixed version (ground truth):
public ProxyDataFactory createProxyDataFactory(AttributeTypes attributeTypes){
  return new AttributeDataProxyFactory(proxyProvider,jdbcClient,attributeTypes);
}
Program: 96914
Project: 96914
Buggy source:
private int loadData(OrcsDataHandler<IndexedResource> handler,int tagQueueQueryId) throws OseeCoreException {
  Consumer<JdbcStatement> consumer=stmt -> {
    int itemId=stmt.getInt("String_Node_Str");
    long typeUuid=stmt.getLong("String_Node_Str");
    long gammaId=stmt.getLong("String_Node_Str");
    String uri=stmt.getString("String_Node_Str");
    String value=stmt.getString("String_Node_Str");
    IndexedResource data=createData(itemId,typeUuid,gammaId,value,uri);
    handler.onData(data);
  }
;
  return jdbcClient.runQuery(consumer,LOAD_ATTRIBUTE,tagQueueQueryId);
}

Fixed version (ground truth):
private int loadData(OrcsDataHandler<IndexedResource> handler,int tagQueueQueryId) throws OseeCoreException {
  Collection<AttributeData> attrData=new HashSet<>();
  Consumer<JdbcStatement> consumer=stmt -> {
    int itemId=stmt.getInt("String_Node_Str");
    long typeUuid=stmt.getLong("String_Node_Str");
    long gammaId=stmt.getLong("String_Node_Str");
    String uri=stmt.getString("String_Node_Str");
    String value=stmt.getString("String_Node_Str");
    attrData.add(new AttributeData(itemId,typeUuid,gammaId,uri,value));
  }
;
  int loaded=jdbcClient.runQuery(consumer,LOAD_ATTRIBUTE,tagQueueQueryId);
  for (  AttributeData attributeData : attrData) {
    StringBuffer sb=new StringBuffer();
    sb=sb.append(attributeData.getValue());
    sb=sb.append(AttributeDataUtil.getNameByGuid(attributeData.getValue(),jdbcClient));
    IndexedResource data=createData(attributeData.getItemId(),attributeData.getTypeUuid(),attributeData.getGammaId(),sb.toString(),attributeData.getUri());
    handler.onData(data);
  }
  return loaded;
}
Program: 96915
Project: 96915
Buggy source:
public boolean isSimilar(Address other){
  return other != null && other.itemId == itemId && other.branchId == branchId;
}

Fixed version (ground truth):
public boolean isSimilar(Address other){
  return other != null && other.itemId == itemId && other.branchId.equals(branchId);
}
Program: 96916
Project: 96916
Buggy source:
public boolean hasSameApplicability(Address other){
  return appId.equals(other.getBranchId());
}

Fixed version (ground truth):
public boolean hasSameApplicability(Address other){
  return appId.equals(other.getApplicabilityId());
}
Program: 96917
Project: 96917
Buggy source:
public void create(){
  Composite applicabilityComp=toolkit.createComposite(form.getForm().getBody(),SWT.WRAP);
  applicabilityComp.setLayout(ALayout.getZeroMarginLayout(2,false));
  applicabilityComp.setLayoutData(new GridData(SWT.BEGINNING,SWT.FILL,true,false));
  text=toolkit.createFormText(applicabilityComp,false);
  text.setText(getArtifactViewApplicabiltyText(),true,false);
  text.setForeground(Displays.getSystemColor(SWT.COLOR_DARK_GRAY));
  button=toolkit.createButton(applicabilityComp,"String_Node_Str",SWT.PUSH);
  refreshButton();
}

Fixed version (ground truth):
public void create(){
  Composite applicabilityComp=toolkit.createComposite(form.getForm().getBody(),SWT.WRAP);
  applicabilityComp.setLayout(ALayout.getZeroMarginLayout(2,false));
  applicabilityComp.setLayoutData(new GridData(SWT.BEGINNING,SWT.FILL,true,false));
  text=toolkit.createFormText(applicabilityComp,false);
  text.setText(getArtifactViewApplicabiltyText(),true,false);
  text.setForeground(Displays.getSystemColor(SWT.COLOR_DARK_GRAY));
  button=toolkit.createButton(applicabilityComp,"String_Node_Str",SWT.PUSH);
  setButtonChangeable();
}
Program: 96918
Project: 96918
Buggy source:
public void refresh(){
  text.setText(getArtifactViewApplicabiltyText(),true,false);
  refreshButton();
}

Fixed version (ground truth):
public void refresh(){
  text.setText(getArtifactViewApplicabiltyText(),true,false);
}
Program: 96920
Project: 96920
Buggy source:
@Override public int getApplicabilityRating(PresentationType presentationType,IArtifact artifact,Object... objects) throws OseeCoreException {
  Artifact aArtifact=artifact.getFullArtifact();
  if (aArtifact.isOfType(AtsArtifactTypes.WorkDefinition) && presentationType != GENERALIZED_EDIT) {
    return PRESENTATION_SUBTYPE_MATCH;
  }
  return NO_MATCH;
}

Fixed version (ground truth):
@Override public int getApplicabilityRating(PresentationType presentationType,IArtifact artifact,Object... objects) throws OseeCoreException {
  Artifact aArtifact=artifact.getFullArtifact();
  if (aArtifact.isOfType(AtsArtifactTypes.WorkDefinition) && presentationType != GENERALIZED_EDIT) {
    return ARTIFACT_TYPE_MATCH;
  }
  return NO_MATCH;
}
Program: 96921
Project: 96921
Buggy source:
@Override public int getApplicabilityRating(PresentationType presentationType,IArtifact artifact,Object... objects) throws OseeCoreException {
  Artifact aArtifact=artifact.getFullArtifact();
  if (aArtifact.isOfType(AtsArtifactTypes.WorkDefinition) && presentationType != GENERALIZED_EDIT) {
    return PRESENTATION_SUBTYPE_MATCH;
  }
  return NO_MATCH;
}

Fixed version (ground truth):
@Override public int getApplicabilityRating(PresentationType presentationType,IArtifact artifact,Object... objects) throws OseeCoreException {
  Artifact aArtifact=artifact.getFullArtifact();
  if (aArtifact.isOfType(AtsArtifactTypes.WorkDefinition) && presentationType != GENERALIZED_EDIT) {
    return ARTIFACT_TYPE_MATCH;
  }
  return NO_MATCH;
}
Program: 96922
Project: 96922
Buggy source:
private WorkPackageIdColumnUI(){
  super(AtsColumnId.WorkPackageId,AtsColumnId.WorkPackageName.getId(),"String_Node_Str",80,XViewerAlign.Left,false,SortDataType.String,true,"String_Node_Str");
}

Fixed version (ground truth):
private WorkPackageIdColumnUI(){
  super(AtsColumnId.WorkPackageId,AtsColumnId.WorkPackageId.getId(),"String_Node_Str",80,XViewerAlign.Left,false,SortDataType.String,true,"String_Node_Str");
}
Program: 96923
Project: 96923
Buggy source:
@Override public void introduce(OrcsSession session,Long branch,RelationNode source,RelationNode destination) throws OseeCoreException {
  ensureRelationsInitialized(session,source.getGraph(),source);
  Collection<? extends IRelationType> validRelationTypes=getValidRelationTypes(session,destination);
  RelationNodeAdjacencies sourceAdjacencies=source.getGraph().getAdjacencies(source);
  RelationNodeAdjacencies destinationAdjacencies=destination.getGraph().getAdjacencies(destination);
  if (sourceAdjacencies != null) {
    for (    Relation sourceRel : sourceAdjacencies.getAll()) {
      if (validRelationTypes.contains(sourceRel.getRelationType())) {
        Relation destinationRel=findRelationByLocalId(destinationAdjacencies,sourceRel.getOrcsData().getLocalId());
        Relation introduceRelation=relationFactory.introduce(branch,sourceRel.getOrcsData());
        if (destinationRel == null) {
          ArtifactReadable readable=doesRelatedArtifactExist(session,introduceRelation,destination,branch);
          if (readable != null) {
            RelationNode node=proxy.getInternalArtifact(readable);
            relate(session,destination,sourceRel.getRelationType(),node);
          }
        }
 else {
          destinationRel.setOrcsData(introduceRelation.getOrcsData());
          destinationRel.setDirty();
        }
      }
    }
  }
  String orderData=source.getOrderData();
  if (!orderData.isEmpty()) {
    destination.storeOrderData(OrderChange.Forced,source.getOrderData());
  }
}

Fixed version (ground truth):
@Override public void introduce(OrcsSession session,Long branch,RelationNode source,RelationNode destination) throws OseeCoreException {
  ensureRelationsInitialized(session,source.getGraph(),source);
  Collection<? extends IRelationType> validRelationTypes=getValidRelationTypes(session,destination);
  RelationNodeAdjacencies sourceAdjacencies=source.getGraph().getAdjacencies(source);
  RelationNodeAdjacencies destinationAdjacencies=destination.getGraph().getAdjacencies(destination);
  if (sourceAdjacencies != null) {
    for (    Relation sourceRel : sourceAdjacencies.getAll()) {
      if (validRelationTypes.contains(sourceRel.getRelationType())) {
        Relation destinationRel=findRelationByLocalId(destinationAdjacencies,sourceRel.getOrcsData().getLocalId());
        Relation introduceRelation=relationFactory.introduce(branch,sourceRel.getOrcsData());
        if (destinationRel != null) {
          destinationRel.setOrcsData(introduceRelation.getOrcsData());
          destinationRel.setDirty();
        }
      }
    }
  }
  String orderData=source.getOrderData();
  if (!orderData.isEmpty()) {
    destination.storeOrderData(OrderChange.Forced,source.getOrderData());
  }
}
Program: 96924
Project: 96924
Buggy source:
@Override public void setFocus(){
  if (focusWidget != null && !focusWidget.isDisposed()) {
    focusWidget.setFocus();
  }
}

Fixed version (ground truth):
@Override public void setFocus(){
  try {
    String limit=OseeInfo.getCachedValue(VIEW_PART_WAIT_LIMIT);
    int waitLimit=Strings.isNumeric(limit) ? Integer.valueOf(limit) : DEFAULT_WAIT;
    Thread.sleep(waitLimit);
    if (focusWidget != null && !focusWidget.isDisposed()) {
      focusWidget.setFocus();
    }
  }
 catch (  InterruptedException ex) {
  }
}
Program: 96927
Project: 96927
Buggy source:
@Override public void run(){
  String useTitle=Strings.truncate(title,WorldEditor.TITLE_MAX_LENGTH);
  iWorldEditor.setTableTitle(useTitle,warning);
  worldXViewer.setReportingTitle(useTitle + "String_Node_Str" + DateUtil.getDateNow());
}

Fixed version (ground truth):
@Override public void run(){
  iWorldEditor.reSearch();
}
Program: 96928
Project: 96928
Buggy source:
@Override public void refreshActionHandler(){
  try {
    iWorldEditor.reSearch();
  }
 catch (  Exception ex) {
    OseeLog.log(Activator.class,OseeLevel.SEVERE_POPUP,ex);
  }
}

Fixed version (ground truth):
@Override public void refreshActionHandler(){
  try {
    Displays.ensureInDisplayThread(new Runnable(){
      @Override public void run(){
        iWorldEditor.reSearch();
      }
    }
);
  }
 catch (  Exception ex) {
    OseeLog.log(Activator.class,OseeLevel.SEVERE_POPUP,ex);
  }
}
Program: 96930
Project: 96930
Buggy source:
public ShowOpenWorkflowsByReviewType(ShowOpenWorkflowsByReviewType showOpenWorkflowsByArtifactType){
  super(showOpenWorkflowsByArtifactType);
  this.showFinished=showOpenWorkflowsByArtifactType.showFinished;
  this.showWorkflow=showOpenWorkflowsByArtifactType.showWorkflow;
}

Fixed version (ground truth):
public ShowOpenWorkflowsByReviewType(ShowOpenWorkflowsByReviewType showOpenWorkflowsByArtifactType){
  super(showOpenWorkflowsByArtifactType);
  this.showFinished=showOpenWorkflowsByArtifactType.showFinished;
  this.showWorkflow=showOpenWorkflowsByArtifactType.showWorkflow;
  this.workItemType=showOpenWorkflowsByArtifactType.workItemType;
}
Program: 96932
Project: 96932
Buggy source:
public void explore(Artifact artifact) throws OseeCoreException {
  if (artifact == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  setPartName("String_Node_Str" + artifact.getBranchToken().getShortName());
  if (branch != null && artifact.getBranch().equals(branch)) {
    explore(Arrays.asList(artifact));
    return;
  }
  explorerRoot=artifact;
  branch=artifact.getBranchToken();
  if (dragAndDropWorker != null) {
    dragAndDropWorker.updateBranch(branch);
  }
  refreshBranchWarning();
  initializeSelectionBox();
  if (treeViewer != null) {
    Object objects[]=treeViewer.getExpandedElements();
    treeViewer.setInput(explorerRoot);
    artifactExplorerMenu.setupPopupMenu();
    artifactExplorerToolbar.updateEnablement();
    treeViewer.setExpandedElements(objects);
  }
}

Fixed version (ground truth):
public void explore(Artifact artifact) throws OseeCoreException {
  if (artifact == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  setPartName("String_Node_Str" + artifact.getBranchToken().getShortName());
  if (branch != null && !artifact.getBranch().equals(branch)) {
    explore(Arrays.asList(artifact));
    return;
  }
  explorerRoot=artifact;
  branch=artifact.getBranchToken();
  if (dragAndDropWorker != null) {
    dragAndDropWorker.updateBranch(branch);
  }
  refreshBranchWarning();
  initializeSelectionBox();
  if (treeViewer != null) {
    Object objects[]=treeViewer.getExpandedElements();
    treeViewer.setInput(explorerRoot);
    artifactExplorerMenu.setupPopupMenu();
    artifactExplorerToolbar.updateEnablement();
    treeViewer.setExpandedElements(objects);
  }
}
Program: 96933
Project: 96933
Buggy source:
public AtsSearchData createSearchData(String namespace,String searchName);

Fixed version (ground truth):
AtsSearchData createSearchData(String namespace,String searchName);
Program: 96934
Project: 96934
Buggy source:
public AtsSearchData fromJson(String namespace,String json);

Fixed version (ground truth):
AtsSearchData fromJson(String namespace,String json);
Program: 96935
Project: 96935
Buggy source:
@Override public IAtsQueryService getQueryService(){
  if (atsQueryService == null) {
    atsQueryService=new AtsQueryServiceIimpl(this);
  }
  return atsQueryService;
}

Fixed version (ground truth):
@Override public IAtsQueryService getQueryService(){
  if (atsQueryService == null) {
    atsQueryService=new AtsQueryServiceImpl(this);
  }
  return atsQueryService;
}
Program: 96936
Project: 96936
Buggy source:
private List<String> getSupportedNamespaces(){
  return AtsSearchUtil.ATS_DEFAULT_SEARCH_NAMESPACES;
}

Fixed version (ground truth):
@Override public List<String> getSupportedNamespaces(){
  return AtsSearchUtil.ATS_DEFAULT_SEARCH_NAMESPACES;
}
Program: 96937
Project: 96937
Buggy source:
@Override public AtsSearchData fromJson(String namespace,String jsonValue){
  if (getSupportedNamespaces().contains(namespace)) {
    try {
      return AtsJsonFactory.getMapper().readValue(jsonValue,AtsSearchData.class);
    }
 catch (    Exception ex) {
      throw new OseeArgumentException(ex,"String_Node_Str",jsonValue);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public AtsSearchData fromJson(String namespace,String jsonValue){
  try {
    return AtsJsonFactory.getMapper().readValue(jsonValue,AtsSearchData.class);
  }
 catch (  Exception ex) {
    throw new OseeArgumentException(ex,"String_Node_Str",jsonValue);
  }
}
Program: 96938
Project: 96938
Buggy source:
public static void refreshTopAtsSearchItem(){
  XNavigateItem searchesItem=NavigateView.getNavigateView().getItem(ATS_SEARCH_NAVIGATE_VIEW_ITEM,true);
  searchesItem.getChildren().clear();
  populateSavedSearchesItem(searchesItem);
  NavigateView.getNavigateView().refresh(searchesItem);
}

Fixed version (ground truth):
public static void refreshTopAtsSearchItem(){
  XNavigateItem searchesItem=NavigateView.getNavigateView().getItem(ATS_SEARCH_NAVIGATE_VIEW_ITEM,true);
  if (searchesItem != null) {
    searchesItem.getChildren().clear();
    populateSavedSearchesItem(searchesItem);
    NavigateView.getNavigateView().refresh(searchesItem);
  }
}
Program: 96939
Project: 96939
Buggy source:
protected void createToolBar(){
  IToolBarManager toolbarManager=getViewSite().getActionBars().getToolBarManager();
  toolbarManager.add(new MyWorldAction());
  toolbarManager.add(new MyFavoritesAction());
  toolbarManager.add(new CollapseAllAction(xNavComp.getFilteredTree().getViewer()));
  toolbarManager.add(new ExpandAllAction(xNavComp.getFilteredTree().getViewer()));
  toolbarManager.add(new OpenChangeReportByIdAction());
  toolbarManager.add(new OpenWorldByIdAction());
  toolbarManager.add(new OpenWorkflowByIdAction());
  toolbarManager.add(new NewAction());
  getViewSite().getActionBars().updateActionBars();
  IActionBars bars=getViewSite().getActionBars();
  IMenuManager mm=bars.getMenuManager();
  mm.add(new NewAction());
  mm.add(new NewGoal());
  toolbarManager.update(true);
}

Fixed version (ground truth):
protected void createToolBar(){
  IToolBarManager toolbarManager=getViewSite().getActionBars().getToolBarManager();
  toolbarManager.add(new RefreshAction(this));
  toolbarManager.add(new MyWorldAction());
  toolbarManager.add(new MyFavoritesAction());
  toolbarManager.add(new CollapseAllAction(xNavComp.getFilteredTree().getViewer()));
  toolbarManager.add(new ExpandAllAction(xNavComp.getFilteredTree().getViewer()));
  toolbarManager.add(new OpenChangeReportByIdAction());
  toolbarManager.add(new OpenWorldByIdAction());
  toolbarManager.add(new OpenWorkflowByIdAction());
  toolbarManager.add(new NewAction());
  getViewSite().getActionBars().updateActionBars();
  IActionBars bars=getViewSite().getActionBars();
  IMenuManager mm=bars.getMenuManager();
  mm.add(new NewAction());
  mm.add(new NewGoal());
  toolbarManager.update(true);
}
Program: 96940
Project: 96940
Buggy source:
@Override public IAtsProgram getProgram(IAtsTeamDefinition teamDef){
  IAtsProgram program=null;
  Object object=services.getAttributeResolver().getSoleAttributeValue(teamDef,AtsAttributeTypes.ProgramUuid,null);
  if (object instanceof ArtifactId) {
    program=services.getConfigItemFactory().getProgram((ArtifactId)object);
  }
 else   if (object instanceof String && Strings.isNumeric((String)object)) {
    program=services.getProgramService().getProgram(Long.parseLong((String)object));
  }
  if (program == null) {
    IAtsTeamDefinition topTeamDef=teamDef.getTeamDefinitionHoldingVersions();
    if (!teamDef.equals(topTeamDef)) {
      program=getProgram(teamDef.getParentTeamDef());
    }
  }
  if (program == null) {
    program=(IAtsProgram)services.getQueryService().createQuery(AtsArtifactTypes.Program).andAttr(AtsAttributeTypes.TeamDefinition,services.getStoreService().getGuid(teamDef)).getResults().getOneOrNull();
  }
  return program;
}

Fixed version (ground truth):
@Override public IAtsProgram getProgram(IAtsTeamDefinition teamDef){
  IAtsProgram program=null;
  Object object=services.getAttributeResolver().getSoleAttributeValue(teamDef,AtsAttributeTypes.ProgramUuid,null);
  if (object instanceof ArtifactId) {
    program=services.getConfigItemFactory().getProgram((ArtifactId)object);
  }
 else   if (object instanceof String && Strings.isNumeric((String)object)) {
    program=services.getProgramService().getProgram(Long.parseLong((String)object));
  }
  if (program == null) {
    IAtsTeamDefinition topTeamDef=teamDef.getTeamDefinitionHoldingVersions();
    if (topTeamDef != null && !teamDef.equals(topTeamDef)) {
      program=getProgram(teamDef.getParentTeamDef());
    }
  }
  if (program == null) {
    program=(IAtsProgram)services.getQueryService().createQuery(AtsArtifactTypes.Program).andAttr(AtsAttributeTypes.TeamDefinition,services.getStoreService().getGuid(teamDef)).getResults().getOneOrNull();
  }
  return program;
}
Program: 96941
Project: 96941
Buggy source:
@DELETE @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON}) Response deleteWorkPackageItems(@PathParam("String_Node_Str") long workPackageId,JaxWorkPackageData workPackageData);

Fixed version (ground truth):
@DELETE @Path("String_Node_Str") @Consumes({MediaType.APPLICATION_JSON}) Response deleteWorkPackageItems(JaxWorkPackageData workPackageData);
Program: 96942
Project: 96942
Buggy source:
@Test public void testSetRemoveWorkPackageItems(){
  Collection<IAtsWorkItem> workItems=workPackageEp.getWorkItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid());
  assertEquals(2,workItems.size());
  IAtsWorkItem workItem=workItems.iterator().next();
  JaxWorkPackageData data=new JaxWorkPackageData();
  data.setAsUserId(AtsClientService.get().getUserService().getCurrentUserId());
  data.getWorkItemUuids().add(workItem.getUuid());
  workPackageEp.deleteWorkPackageItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid(),data);
  assertEquals(1,workPackageEp.getWorkItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid()).size());
  workPackageEp.setWorkPackage(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid(),data);
  assertEquals(2,workPackageEp.getWorkItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid()).size());
}

Fixed version (ground truth):
@Test public void testSetRemoveWorkPackageItems(){
  Collection<IAtsWorkItem> workItems=workPackageEp.getWorkItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid());
  assertEquals(2,workItems.size());
  IAtsWorkItem workItem=workItems.iterator().next();
  JaxWorkPackageData data=new JaxWorkPackageData();
  data.setAsUserId(AtsClientService.get().getUserService().getCurrentUserId());
  data.getWorkItemUuids().add(workItem.getUuid());
  workPackageEp.deleteWorkPackageItems(data);
  assertEquals(1,workPackageEp.getWorkItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid()).size());
  workPackageEp.setWorkPackage(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid(),data);
  assertEquals(2,workPackageEp.getWorkItems(DemoArtifactToken.SAW_Code_Team_WorkPackage_01.getUuid()).size());
}
Program: 96943
Project: 96943
Buggy source:
private void changeWorkPackage(IAtsWorkPackage workPackage,Collection<IAtsWorkItem> workItems,boolean remove){
  JaxWorkPackageData data=new JaxWorkPackageData();
  data.setAsUserId(services.getUserService().getCurrentUserId());
  for (  IAtsWorkItem workItem : workItems) {
    data.getWorkItemUuids().add(workItem.getUuid());
  }
  AtsWorkPackageEndpointApi workPackageEp=AtsClientService.getWorkPackageEndpoint();
  if (remove) {
    workPackageEp.deleteWorkPackageItems(workPackage.getUuid(),data);
  }
 else {
    workPackageEp.setWorkPackage(workPackage.getUuid(),data);
  }
  TopicEvent event=new TopicEvent(AtsTopicEvent.WORK_ITEM_MODIFIED,AtsTopicEvent.WORK_ITEM_UUDS_KEY,AtsObjects.toUuidsString("String_Node_Str",workItems));
  OseeEventManager.kickTopicEvent(getClass(),event);
  services.getStoreService().reload(workItems);
}

Fixed version (ground truth):
private void changeWorkPackage(IAtsWorkPackage workPackage,Collection<IAtsWorkItem> workItems,boolean remove){
  JaxWorkPackageData data=new JaxWorkPackageData();
  data.setAsUserId(services.getUserService().getCurrentUserId());
  for (  IAtsWorkItem workItem : workItems) {
    data.getWorkItemUuids().add(workItem.getUuid());
  }
  AtsWorkPackageEndpointApi workPackageEp=AtsClientService.getWorkPackageEndpoint();
  if (remove) {
    workPackageEp.deleteWorkPackageItems(data);
  }
 else {
    workPackageEp.setWorkPackage(workPackage.getUuid(),data);
  }
  TopicEvent event=new TopicEvent(AtsTopicEvent.WORK_ITEM_MODIFIED,AtsTopicEvent.WORK_ITEM_UUDS_KEY,AtsObjects.toUuidsString("String_Node_Str",workItems));
  OseeEventManager.kickTopicEvent(getClass(),event);
  services.getStoreService().reload(workItems);
}