nus-yam/ex-repair huggingface dataset:
Program: 96855
Project: 96855
Buggy source:
@Override public List<DispoItem> importDirectory(Map<String,DispoItem> exisitingItems,File tmoDirectory,OperationReport report){
  List<DispoItem> toReturn=new LinkedList<>();
  if (tmoDirectory.isDirectory()) {
    List<File> listOfFiles=Lib.recursivelyListFiles(tmoDirectory,Pattern.compile("String_Node_Str"));
    int numThreads=8;
    int partitionSize=listOfFiles.size() / numThreads;
    int remainder=listOfFiles.size() % numThreads;
    int startIndex=0;
    int endIndex=0;
    List<Future<List<DispoItem>>> futures=new LinkedList<>();
    for (int i=0; i < numThreads; i++) {
      startIndex=endIndex;
      endIndex=startIndex + partitionSize;
      if (i == 0) {
        endIndex+=remainder;
      }
      List<File> sublist=listOfFiles.subList(startIndex,endIndex);
      Worker worker=new Worker(sublist,dataFactory,exisitingItems,report);
      Future<List<DispoItem>> future;
      try {
        future=executor.schedule(worker);
        futures.add(future);
      }
 catch (      Exception ex) {
        logger.error(ex,"String_Node_Str");
      }
    }
    for (    Future<List<DispoItem>> future : futures) {
      try {
        toReturn.addAll(future.get());
      }
 catch (      Exception ex) {
        logger.error(ex,"String_Node_Str");
      }
    }
  }
  return toReturn;
}

Fixed version (ground truth):
@Override public List<DispoItem> importDirectory(Map<String,DispoItem> exisitingItems,File tmoDirectory,OperationReport report){
  List<DispoItem> toReturn=new LinkedList<>();
  if (tmoDirectory.isDirectory()) {
    List<File> listOfFiles=Lib.recursivelyListFiles(tmoDirectory,Pattern.compile("String_Node_Str"));
    int numThreads=8;
    int partitionSize=listOfFiles.size() / numThreads;
    int remainder=listOfFiles.size() % numThreads;
    int startIndex=0;
    int endIndex=0;
    List<Future<List<DispoItem>>> futures=new LinkedList<>();
    for (int i=0; i < numThreads; i++) {
      startIndex=endIndex;
      endIndex=startIndex + partitionSize;
      if (i == 0) {
        endIndex+=remainder;
      }
      List<File> sublist=listOfFiles.subList(startIndex,endIndex);
      Worker worker=new Worker(sublist,dataFactory,exisitingItems,report);
      Future<List<DispoItem>> future;
      try {
        future=executor.schedule(worker);
        futures.add(future);
      }
 catch (      Exception ex) {
        report.addEntry("String_Node_Str",ex.getLocalizedMessage(),DispoSummarySeverity.ERROR);
      }
    }
    for (    Future<List<DispoItem>> future : futures) {
      try {
        toReturn.addAll(future.get());
      }
 catch (      Exception ex) {
        report.addEntry("String_Node_Str",ex.getLocalizedMessage(),DispoSummarySeverity.ERROR);
      }
    }
  }
  return toReturn;
}
Program: 96859
Project: 96859
Buggy source:
private void processExceptionHandled(OperationReport report){
  for (  String datId : datIdsCoveredByException) {
    Matcher matcher=Pattern.compile("String_Node_Str").matcher(datId);
    matcher.find();
    String itemDatId=matcher.group();
    DispoItemData item=datIdToItem.get(itemDatId);
    String line=datId.replaceAll("String_Node_Str","String_Node_Str");
    line=line.replaceAll("String_Node_Str","String_Node_Str");
    String text="String_Node_Str";
    Discrepancy matchingDiscrepancy=matchDiscrepancy(line,item.getDiscrepanciesList());
    if (matchingDiscrepancy != null) {
      text=matchingDiscrepancy.getText();
      Map<String,Discrepancy> discrepancies=item.getDiscrepanciesList();
      discrepancies.remove(matchingDiscrepancy.getId());
      addAnnotationForForCoveredLine(item,line,Exception_Handling_Resolution,"String_Node_Str",text);
    }
  }
}

Fixed version (ground truth):
private void processExceptionHandled(OperationReport report){
  for (  String datId : datIdsCoveredByException) {
    Matcher matcher=Pattern.compile("String_Node_Str").matcher(datId);
    matcher.find();
    String itemDatId=matcher.group();
    DispoItemData item=datIdToItem.get(itemDatId);
    String line=datId.replaceAll("String_Node_Str","String_Node_Str");
    line=line.replaceAll("String_Node_Str","String_Node_Str");
    String text="String_Node_Str";
    Discrepancy matchingDiscrepancy=matchDiscrepancy(line,item.getDiscrepanciesList());
    if (matchingDiscrepancy != null) {
      text=matchingDiscrepancy.getText();
      Map<String,Discrepancy> discrepancies=item.getDiscrepanciesList();
      discrepancies.remove(matchingDiscrepancy.getId());
      addAnnotationForForCoveredLine(item,line,Exception_Handling_Resolution,text,"String_Node_Str");
    }
  }
}
Program: 96860
Project: 96860
Buggy source:
private int getTotalLocationOfAnnotation(DispoAnnotationData annotation){
  String locationRefs=annotation.getLocationRefs();
  String[] locationsRefsArray=locationRefs.split("String_Node_Str");
  int toReturn=0;
  for (int i=0; i < locationsRefsArray.length; i++) {
    String singleRef=locationsRefsArray[i];
    if (singleRef.contains("String_Node_Str")) {
      String[] split=singleRef.split("String_Node_Str");
      int gap=Integer.valueOf(split[1]) - Integer.valueOf(split[0]);
      toReturn+=gap + 1;
    }
 else {
      toReturn++;
    }
  }
  return toReturn;
}

Fixed version (ground truth):
private int getTotalLocationOfAnnotation(DispoAnnotationData annotation){
  String locationRefs=annotation.getLocationRefs();
  String[] locationsRefsArray=locationRefs.split("String_Node_Str");
  int toReturn=0;
  for (int i=0; i < locationsRefsArray.length; i++) {
    String singleRef=locationsRefsArray[i].trim();
    if (singleRef.contains("String_Node_Str")) {
      String[] split=singleRef.split("String_Node_Str");
      int gap=Integer.valueOf(split[1]) - Integer.valueOf(split[0]);
      toReturn+=gap + 1;
    }
 else {
      toReturn++;
    }
  }
  return toReturn;
}
Program: 96861
Project: 96861
Buggy source:
@Path("String_Node_Str") @POST @RolesAllowed(DispoRoles.ROLES_ADMINISTRATOR) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response getDispoSetCopyCoverage(@QueryParam("String_Node_Str") String destinationSet,@QueryParam("String_Node_Str") Long sourceBranch,@QueryParam("String_Node_Str") String sourcePackage,CopySetParams params){
  Response.Status status;
  final DispoSet destination=dispoApi.getDispoSetById(program,destinationSet);
  dispoApi.copyDispoSetCoverage(sourceBranch,sourcePackage,program,destination,params);
  status=Status.OK;
  return Response.status(status).build();
}

Fixed version (ground truth):
@Path("String_Node_Str") @POST @RolesAllowed(DispoRoles.ROLES_ADMINISTRATOR) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response getDispoSetCopyCoverage(@QueryParam("String_Node_Str") String destinationSet,@QueryParam("String_Node_Str") Long sourceBranch,@QueryParam("String_Node_Str") Long sourcePackage,CopySetParams params){
  Response.Status status;
  final DispoSet destination=dispoApi.getDispoSetById(program,destinationSet);
  dispoApi.copyDispoSetCoverage(sourceBranch,sourcePackage,program,destination,params);
  status=Status.OK;
  return Response.status(status).build();
}
Program: 96862
Project: 96862
Buggy source:
public static OperationReport jsonObjToOperationSummary(JSONObject jObj){
  OperationReport summary=new OperationReport();
  List<OperationSummaryEntry> entries=new ArrayList<>();
  try {
    JSONArray entriesJson=jObj.getJSONArray("String_Node_Str");
    if (jObj.has("String_Node_Str")) {
      for (int i=0; i < entriesJson.length(); i++) {
        JSONObject entryAsJson=entriesJson.getJSONObject(i);
        OperationSummaryEntry entry=jsonObjToOperationSummaryEntry(entryAsJson);
        entries.add(entry);
      }
      summary.setEntries(entries);
    }
  }
 catch (  JSONException ex) {
  }
  return summary;
}

Fixed version (ground truth):
public static OperationReport jsonObjToOperationSummary(JSONObject jObj){
  OperationReport summary=new OperationReport();
  List<OperationSummaryEntry> entries=new ArrayList<>();
  try {
    if (jObj.has("String_Node_Str")) {
      JSONArray entriesJson=jObj.getJSONArray("String_Node_Str");
      for (int i=0; i < entriesJson.length(); i++) {
        JSONObject entryAsJson=entriesJson.getJSONObject(i);
        OperationSummaryEntry entry=jsonObjToOperationSummaryEntry(entryAsJson);
        entries.add(entry);
      }
      summary.setEntries(entries);
    }
  }
 catch (  JSONException ex) {
  }
  return summary;
}
Program: 96863
Project: 96863
Buggy source:
public static boolean isNumericLocations(String str){
  Matcher matcher=pattern.matcher(str);
  return matcher.matches();
}

Fixed version (ground truth):
public static boolean isNumericLocations(String str){
  Matcher matcher=pattern.matcher(str.trim());
  return matcher.matches();
}
Program: 96864
Project: 96864
Buggy source:
public static JdbcDbType getDbType(DatabaseMetaData metaData){
  try {
    String dbName=metaData.getDatabaseProductName();
    JdbcDbType dbType;
    String lowerCaseName=dbName.toLowerCase();
    if (lowerCaseName.contains("String_Node_Str")) {
      dbType=h2;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=oracle;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=foxpro;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=mysql;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=postgresql;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=hsql;
    }
 else {
      throw newJdbcException("String_Node_Str",dbName);
    }
    boolean hintsSupported=dbType.equals(oracle) && metaData.getDatabaseMajorVersion() > 10;
    return new JdbcDbType(dbType.getId(),hintsSupported);
  }
 catch (  SQLException ex) {
    throw newJdbcException(ex);
  }
}

Fixed version (ground truth):
public static JdbcDbType getDbType(DatabaseMetaData metaData){
  try {
    String dbName=metaData.getDatabaseProductName();
    JdbcDbType dbType;
    String lowerCaseName=dbName.toLowerCase();
    if (lowerCaseName.contains("String_Node_Str")) {
      dbType=h2;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=oracle;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=foxpro;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=mysql;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=postgresql;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=hsql;
    }
 else     if (lowerCaseName.contains("String_Node_Str")) {
      dbType=sqlite;
    }
 else {
      throw newJdbcException("String_Node_Str",dbName);
    }
    boolean hintsSupported=dbType.equals(oracle) && metaData.getDatabaseMajorVersion() > 10;
    return new JdbcDbType(dbType.getId(),hintsSupported);
  }
 catch (  SQLException ex) {
    throw newJdbcException(ex);
  }
}
Program: 96866
Project: 96866
Buggy source:
/** 
 * Called before a resource method is executed
 */
@Override public void filter(ContainerRequestContext context){
  if (activityLog.isEnabled()) {
    try {
      String message=String.format("String_Node_Str",context.getMethod(),context.getUriInfo().getRequestUri());
      Long serverId=getServerId(context);
      Long clientId=ActivityConstants.DEFAULT_CLIENT_ID;
      if (Strings.isNumeric(context.getHeaders().getFirst("String_Node_Str"))) {
        clientId=Long.valueOf(context.getHeaders().getFirst("String_Node_Str"));
      }
      Long accountId=ActivityConstants.DEFAULT_ACCOUNT_ID;
      if (Strings.isNumeric(context.getHeaders().getFirst("String_Node_Str"))) {
        accountId=Long.valueOf(context.getHeaders().getFirst("String_Node_Str"));
      }
      Long entryId=activityLog.createActivityThread(Activity.JAXRS_METHOD_CALL,accountId,serverId,clientId,message);
      context.setProperty(ActivityConstants.HTTP_HEADER__ACTIVITY_ENTRY_ID,entryId);
    }
 catch (    Throwable th) {
      logger.error(th,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Called before a resource method is executed
 */
@Override public void filter(ContainerRequestContext context){
  if (activityLog.isEnabled()) {
    try {
      String message=String.format("String_Node_Str",context.getMethod(),context.getUriInfo().getPath());
      Long serverId=getServerId(context);
      Long clientId=ActivityConstants.DEFAULT_CLIENT_ID;
      if (Strings.isNumeric(context.getHeaders().getFirst("String_Node_Str"))) {
        clientId=Long.valueOf(context.getHeaders().getFirst("String_Node_Str"));
      }
      Long accountId=ActivityConstants.DEFAULT_ACCOUNT_ID;
      if (Strings.isNumeric(context.getHeaders().getFirst("String_Node_Str"))) {
        accountId=Long.valueOf(context.getHeaders().getFirst("String_Node_Str"));
      }
      Long entryId=activityLog.createActivityThread(Activity.JAXRS_METHOD_CALL,accountId,serverId,clientId,message);
      context.setProperty(ActivityConstants.HTTP_HEADER__ACTIVITY_ENTRY_ID,entryId);
    }
 catch (    Throwable th) {
      logger.error(th,"String_Node_Str");
    }
  }
}
Program: 96867
Project: 96867
Buggy source:
public Resource findResource(ContainerRequestContext requestContext){
  UriInfo uriInfo=requestContext.getUriInfo();
  String path=uriInfo.getAbsolutePath().getPath();
  Resource resource=getResource(path);
  if (resource == null) {
    if (!hasExtension(path)) {
      List<MediaType> mediaTypes=getMediaTypesToSearch(requestContext);
      for (      MediaType mediaType : mediaTypes) {
        String resourcePath=addExtension(path,mediaType);
        if (Strings.isValid(resourcePath)) {
          resource=getResource(resourcePath);
          if (resource != null) {
            break;
          }
        }
      }
    }
  }
  return resource;
}

Fixed version (ground truth):
public Resource findResource(ContainerRequestContext requestContext){
  UriInfo uriInfo=requestContext.getUriInfo();
  String path=uriInfo.getPath(false);
  Resource resource=getResource(path);
  if (resource == null) {
    if (!hasExtension(path)) {
      List<MediaType> mediaTypes=getMediaTypesToSearch(requestContext);
      for (      MediaType mediaType : mediaTypes) {
        String resourcePath=addExtension(path,mediaType);
        if (Strings.isValid(resourcePath)) {
          resource=getResource(resourcePath);
          if (resource != null) {
            break;
          }
        }
      }
    }
  }
  return resource;
}
Program: 96868
Project: 96868
Buggy source:
@Override public void filter(ContainerRequestContext context){
  boolean isSecurePath=isPathSecure(context);
  UriInfo uriInfo=context.getUriInfo();
  String path=uriInfo.getAbsolutePath().getPath();
  if (isSecurePath && path.contains("String_Node_Str") || path.contains("String_Node_Str")) {
    if (isResourceOwnerRequest(context)) {
      handleResourceOwnerRequest(context);
    }
 else {
      super.filter(context);
    }
  }
}

Fixed version (ground truth):
@Override public void filter(ContainerRequestContext context){
  boolean isSecurePath=isPathSecure(context);
  UriInfo uriInfo=context.getUriInfo();
  String path=uriInfo.getPath();
  if (isSecurePath && path.contains("String_Node_Str") || path.contains("String_Node_Str")) {
    if (isResourceOwnerRequest(context)) {
      handleResourceOwnerRequest(context);
    }
 else {
      super.filter(context);
    }
  }
}
Program: 96870
Project: 96870
Buggy source:
@Test public void testPublishDiffWithFieldCodes() throws OseeCoreException {
  modifyOption("String_Node_Str",updateBranch);
  modifyOption("String_Node_Str",true);
  List<Artifact> artifacts=new ArrayList<>();
  setupFieldCodeChange();
  Artifact updateDoc=ArtifactQuery.getArtifactFromId(docFolder.getArtId(),updateBranch);
  artifacts.add(updateDoc);
  renderer.publish(singleTemplate,null,artifacts,options);
  String resultPath=renderer.getStringOption(IRenderer.RESULT_PATH_RETURN);
  Assert.assertNotEquals(String.format("String_Node_Str",method.getQualifiedTestName()),resultPath,null);
  try {
    String contents=getFileAsString(resultPath);
    basicDocumentCheck(contents,"String_Node_Str",false,true);
    Assert.assertTrue("String_Node_Str",contents.contains("String_Node_Str"));
    Assert.assertTrue("String_Node_Str",contents.contains("String_Node_Str"));
  }
 catch (  IOException ex) {
  }
}

Fixed version (ground truth):
@Test public void testPublishDiffWithFieldCodes() throws OseeCoreException {
  modifyOption("String_Node_Str",updateBranch);
  modifyOption("String_Node_Str",true);
  List<Artifact> artifacts=new ArrayList<>();
  setupFieldCodeChange();
  Artifact updateDoc=ArtifactQuery.getArtifactFromId(docFolder.getArtId(),updateBranch);
  artifacts.add(updateDoc);
  renderer.publish(singleTemplate,null,artifacts,options);
  String resultPath=renderer.getStringOption(IRenderer.RESULT_PATH_RETURN);
  Assert.assertNotEquals(String.format("String_Node_Str",method.getQualifiedTestName()),resultPath,null);
  try {
    String contents=getFileAsString(resultPath);
    basicDocumentCheck(contents,"String_Node_Str",false,true);
    Assert.assertTrue("String_Node_Str",contents.contains("String_Node_Str"));
  }
 catch (  IOException ex) {
  }
}
Program: 96872
Project: 96872
Buggy source:
public AtsProgramService(IAtsServices services){
  this.services=services;
}

Fixed version (ground truth):
public AtsProgramService(IAtsServices services){
  AtsProgramService.services=services;
}
Program: 96873
Project: 96873
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 (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;
}

Fixed version (ground truth):
@Override public IAtsProgram getProgram(IAtsTeamDefinition teamDef){
  try {
    return teamDefToAtsProgramCache.get(teamDef);
  }
 catch (  Exception ex) {
  }
  return null;
}
Program: 96874
Project: 96874
Buggy source:
@Test public void testAddChildren() throws OseeCoreException {
  when(container1.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(node1,DEFAULT_HIERARCHY,node2)).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(orderManager1.getSorterId(Default_Hierarchical__Child)).thenReturn(UNORDERED);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType2,SIDE_B)).thenReturn(10);
  List<? extends RelationNode> children=Arrays.asList(node2);
  manager.addChildren(session,node1,children);
  verify(container1).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(orderManager1).getSorterId(Default_Hierarchical__Child);
  verify(orderManager1).setOrder(eq(Default_Hierarchical__Child),eq(UNORDERED),sortedListCaptor.capture());
  verify(container1).add(DEFAULT_HIERARCHY.getGuid(),relation1);
  verify(container2).add(DEFAULT_HIERARCHY.getGuid(),relation1);
}

Fixed version (ground truth):
@Test public void testAddChildren() throws OseeCoreException {
  when(container1.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(eq(node1),eq(DEFAULT_HIERARCHY),eq(node2),Matchers.anyString())).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(orderManager1.getSorterId(Default_Hierarchical__Child)).thenReturn(UNORDERED);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType2,SIDE_B)).thenReturn(10);
  List<? extends RelationNode> children=Arrays.asList(node2);
  manager.addChildren(session,node1,children);
  verify(container1).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(orderManager1).getSorterId(Default_Hierarchical__Child);
  verify(orderManager1).setOrder(eq(Default_Hierarchical__Child),eq(UNORDERED),sortedListCaptor.capture());
  verify(container1).add(DEFAULT_HIERARCHY.getGuid(),relation1);
  verify(container2).add(DEFAULT_HIERARCHY.getGuid(),relation1);
}
Program: 96875
Project: 96875
Buggy source:
@Test public void testRelateNoSorting() throws OseeCoreException {
  when(container1.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(node1,TYPE_1,node2)).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  IRelationTypeSide typeSide=RelationUtil.asTypeSide(TYPE_1,SIDE_B);
  when(orderManager1.getSorterId(typeSide)).thenReturn(UNORDERED);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType2,SIDE_B)).thenReturn(10);
  manager.relate(session,node1,TYPE_1,node2);
  verify(container1).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(relationFactory).createRelation(node1,TYPE_1,node2);
  verify(orderManager1).getSorterId(typeSide);
  verify(orderManager1).setOrder(eq(typeSide),eq(UNORDERED),sortedListCaptor.capture());
  verify(container1).add(TYPE_1.getGuid(),relation1);
  verify(container2).add(TYPE_1.getGuid(),relation1);
}

Fixed version (ground truth):
@Test public void testRelateNoSorting() throws OseeCoreException {
  when(container1.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(eq(node1),eq(TYPE_1),eq(node2),Matchers.anyString())).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  IRelationTypeSide typeSide=RelationUtil.asTypeSide(TYPE_1,SIDE_B);
  when(orderManager1.getSorterId(typeSide)).thenReturn(UNORDERED);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType2,SIDE_B)).thenReturn(10);
  manager.relate(session,node1,TYPE_1,node2);
  verify(container1).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(orderManager1).getSorterId(typeSide);
  verify(orderManager1).setOrder(eq(typeSide),eq(UNORDERED),sortedListCaptor.capture());
  verify(container1).add(TYPE_1.getGuid(),relation1);
  verify(container2).add(TYPE_1.getGuid(),relation1);
}
Program: 96877
Project: 96877
Buggy source:
@Test public void testRelateWithSorting() throws OseeCoreException {
  when(container1.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(node1,TYPE_1,node2)).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType2,SIDE_B)).thenReturn(10);
  manager.relate(session,node1,TYPE_1,node2,LEXICOGRAPHICAL_ASC);
  IRelationTypeSide typeSide=RelationUtil.asTypeSide(TYPE_1,SIDE_B);
  verify(container1).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(relationFactory).createRelation(node1,TYPE_1,node2);
  verify(orderManager1).setOrder(eq(typeSide),eq(LEXICOGRAPHICAL_ASC),sortedListCaptor.capture());
  verify(container1).add(TYPE_1.getGuid(),relation1);
  verify(container2).add(TYPE_1.getGuid(),relation1);
}

Fixed version (ground truth):
@Test public void testRelateWithSorting() throws OseeCoreException {
  when(container1.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,TYPE_1,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(eq(node1),eq(TYPE_1),eq(node2),Matchers.anyString())).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(TYPE_1,artifactType2,SIDE_B)).thenReturn(10);
  manager.relate(session,node1,TYPE_1,node2,LEXICOGRAPHICAL_ASC);
  IRelationTypeSide typeSide=RelationUtil.asTypeSide(TYPE_1,SIDE_B);
  verify(container1).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,TYPE_1,node2,INCLUDE_DELETED);
  verify(orderManager1).setOrder(eq(typeSide),eq(LEXICOGRAPHICAL_ASC),sortedListCaptor.capture());
  verify(container1).add(TYPE_1.getGuid(),relation1);
  verify(container2).add(TYPE_1.getGuid(),relation1);
}
Program: 96878
Project: 96878
Buggy source:
@Test public void testAddChild() throws OseeCoreException {
  when(container1.getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(node1,DEFAULT_HIERARCHY,node2)).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(orderManager1.getSorterId(Default_Hierarchical__Child)).thenReturn(UNORDERED);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType2,SIDE_B)).thenReturn(10);
  manager.addChild(session,node1,node2);
  verify(container1).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(orderManager1).getSorterId(Default_Hierarchical__Child);
  verify(orderManager1).setOrder(eq(Default_Hierarchical__Child),eq(UNORDERED),sortedListCaptor.capture());
  verify(container1).add(DEFAULT_HIERARCHY.getGuid(),relation1);
  verify(container2).add(DEFAULT_HIERARCHY.getGuid(),relation1);
}

Fixed version (ground truth):
@Test public void testAddChild() throws OseeCoreException {
  when(container1.getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED)).thenReturn(null);
  when(container2.getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED)).thenReturn(null);
  when(relationFactory.createRelation(eq(node1),eq(DEFAULT_HIERARCHY),eq(node2),Matchers.anyString())).thenReturn(relation1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
  when(orderManager1.getSorterId(Default_Hierarchical__Child)).thenReturn(UNORDERED);
  when(node1.getArtifactType()).thenReturn(artifactType1);
  when(node2.getArtifactType()).thenReturn(artifactType2);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType1,SIDE_A)).thenReturn(10);
  when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child,artifactType2,SIDE_B)).thenReturn(10);
  manager.addChild(session,node1,node2);
  verify(container1).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(container2).getRelation(node1,DEFAULT_HIERARCHY,node2,INCLUDE_DELETED);
  verify(orderManager1).getSorterId(Default_Hierarchical__Child);
  verify(orderManager1).setOrder(eq(Default_Hierarchical__Child),eq(UNORDERED),sortedListCaptor.capture());
  verify(container1).add(DEFAULT_HIERARCHY.getGuid(),relation1);
  verify(container2).add(DEFAULT_HIERARCHY.getGuid(),relation1);
}
Program: 96879
Project: 96879
Buggy source:
public Relation createRelation(RelationNode aNode,IRelationType type,RelationNode bNode) throws OseeCoreException {
  OrcsConditions.checkBranch(aNode,bNode);
  OrcsConditions.checkRelateSelf(aNode,bNode);
  RelationData data=relationDataFactory.createRelationData(type,aNode.getBranchId(),aNode,bNode,"String_Node_Str");
  return createRelation(data);
}

Fixed version (ground truth):
public Relation createRelation(RelationNode aNode,IRelationType type,RelationNode bNode,String rationale) throws OseeCoreException {
  OrcsConditions.checkBranch(aNode,bNode);
  OrcsConditions.checkRelateSelf(aNode,bNode);
  RelationData data=relationDataFactory.createRelationData(type,aNode.getBranchId(),aNode,bNode,rationale);
  return createRelation(data);
}
Program: 96880
Project: 96880
Buggy source:
@Override public void relate(OrcsSession session,RelationNode aNode,IRelationType type,RelationNode bNode,String rationale,IRelationSorterId sortType) throws OseeCoreException {
  checkBranch(aNode,bNode);
  checkRelateSelf(aNode,bNode);
  GraphData graph=getGraph(aNode,bNode);
  validity.checkRelationTypeValid(type,aNode,SIDE_A);
  validity.checkRelationTypeValid(type,bNode,SIDE_B);
  checkMultiplicityCanAdd(session,type,aNode,bNode);
  Relation relation=getRelation(session,aNode,type,bNode,INCLUDE_DELETED).getOneOrNull();
  boolean updated=false;
  if (relation == null) {
    relation=relationFactory.createRelation(aNode,type,bNode);
    graph.<RelationNodeAdjacencies>getAdjacencies(aNode).add(type.getGuid(),relation);
    graph.<RelationNodeAdjacencies>getAdjacencies(bNode).add(type.getGuid(),relation);
    updated=true;
  }
  if (relation.isDeleted()) {
    relation.unDelete();
    updated=true;
  }
  if (updated) {
    relation.setDirty();
    order(session,type,aNode,SIDE_A,sortType,OrderOp.ADD_TO_ORDER,Collections.singleton(bNode));
  }
}

Fixed version (ground truth):
@Override public void relate(OrcsSession session,RelationNode aNode,IRelationType type,RelationNode bNode,String rationale,IRelationSorterId sortType) throws OseeCoreException {
  checkBranch(aNode,bNode);
  checkRelateSelf(aNode,bNode);
  GraphData graph=getGraph(aNode,bNode);
  validity.checkRelationTypeValid(type,aNode,SIDE_A);
  validity.checkRelationTypeValid(type,bNode,SIDE_B);
  checkMultiplicityCanAdd(session,type,aNode,bNode);
  Relation relation=getRelation(session,aNode,type,bNode,INCLUDE_DELETED).getOneOrNull();
  boolean updated=false;
  if (relation == null) {
    relation=relationFactory.createRelation(aNode,type,bNode,rationale);
    graph.<RelationNodeAdjacencies>getAdjacencies(aNode).add(type.getGuid(),relation);
    graph.<RelationNodeAdjacencies>getAdjacencies(bNode).add(type.getGuid(),relation);
    updated=true;
  }
  if (relation.isDeleted()) {
    relation.unDelete();
    updated=true;
  }
  if (updated) {
    relation.setDirty();
    order(session,type,aNode,SIDE_A,sortType,OrderOp.ADD_TO_ORDER,Collections.singleton(bNode));
  }
}
Program: 96881
Project: 96881
Buggy source:
private RelationData createRelationData(VersionData version,int localId,long localTypeID,ModificationType modType,long baseLocalTypeID,ModificationType baseModType,int aArtId,int bArtId,String rationale,ApplicabilityId applicId){
  RelationData data=new RelationDataImpl(version);
  data.setLocalId(localId);
  data.setTypeUuid(localTypeID);
  data.setBaseTypeUuid(baseLocalTypeID);
  data.setModType(modType);
  data.setBaseModType(baseModType);
  data.setArtIdA(aArtId);
  data.setArtIdB(bArtId);
  data.setRationale(rationale);
  data.setApplicabilityId(applicId);
  return data;
}

Fixed version (ground truth):
private RelationData createRelationData(VersionData version,int localId,long localTypeID,ModificationType modType,long baseLocalTypeID,ModificationType baseModType,int aArtId,int bArtId,String rationale,ApplicabilityId applicId){
  RelationData data=new RelationDataImpl(version);
  data.setLocalId(localId);
  data.setTypeUuid(localTypeID);
  data.setBaseTypeUuid(baseLocalTypeID);
  data.setModType(modType);
  data.setBaseModType(baseModType);
  data.setArtIdA(aArtId);
  data.setArtIdB(bArtId);
  Conditions.assertNotNull(rationale,"String_Node_Str",localId,localTypeID,aArtId,bArtId);
  data.setRationale(rationale);
  data.setApplicabilityId(applicId);
  return data;
}
Program: 96882
Project: 96882
Buggy source:
@Override protected RelationData createData(Object conditions,RelationObjectFactory factory,JdbcStatement chStmt,Options options) throws OseeCoreException {
  RelationData toReturn=null;
  long branchUuid=chStmt.getLong("String_Node_Str");
  int aArtId=chStmt.getInt("String_Node_Str");
  int bArtId=chStmt.getInt("String_Node_Str");
  long typeId=chStmt.getLong("String_Node_Str");
  long gammaId=chStmt.getInt("String_Node_Str");
  ApplicabilityId applicId=ApplicabilityId.valueOf(chStmt.getLong("String_Node_Str"));
  boolean historical=OptionsUtil.isHistorical(options);
  CreateConditions condition=asConditions(conditions);
  if (!condition.isSame(branchUuid,aArtId,bArtId,typeId)) {
    condition.saveConditions(branchUuid,aArtId,bArtId,typeId,gammaId);
    TransactionId txId=TransactionId.valueOf(chStmt.getLong("String_Node_Str"));
    VersionData version=factory.createVersion(branchUuid,txId,gammaId,historical);
    if (historical) {
      version.setStripeId(TransactionId.valueOf(chStmt.getLong("String_Node_Str")));
    }
    int localId=chStmt.getInt("String_Node_Str");
    ModificationType modType=ModificationType.getMod(chStmt.getInt("String_Node_Str"));
    String rationale=chStmt.getString("String_Node_Str");
    toReturn=factory.createRelationData(version,localId,typeId,modType,aArtId,bArtId,rationale,applicId);
  }
 else {
    if (!historical) {
      logger.warn("String_Node_Str",branchUuid,typeId,aArtId,bArtId,condition.previousGammaId,gammaId);
    }
  }
  return toReturn;
}

Fixed version (ground truth):
@Override protected RelationData createData(Object conditions,RelationObjectFactory factory,JdbcStatement chStmt,Options options) throws OseeCoreException {
  RelationData toReturn=null;
  long branchUuid=chStmt.getLong("String_Node_Str");
  int aArtId=chStmt.getInt("String_Node_Str");
  int bArtId=chStmt.getInt("String_Node_Str");
  long typeId=chStmt.getLong("String_Node_Str");
  long gammaId=chStmt.getInt("String_Node_Str");
  ApplicabilityId applicId=ApplicabilityId.valueOf(chStmt.getLong("String_Node_Str"));
  boolean historical=OptionsUtil.isHistorical(options);
  CreateConditions condition=asConditions(conditions);
  if (!condition.isSame(branchUuid,aArtId,bArtId,typeId)) {
    condition.saveConditions(branchUuid,aArtId,bArtId,typeId,gammaId);
    TransactionId txId=TransactionId.valueOf(chStmt.getLong("String_Node_Str"));
    VersionData version=factory.createVersion(branchUuid,txId,gammaId,historical);
    if (historical) {
      version.setStripeId(TransactionId.valueOf(chStmt.getLong("String_Node_Str")));
    }
    int localId=chStmt.getInt("String_Node_Str");
    ModificationType modType=ModificationType.getMod(chStmt.getInt("String_Node_Str"));
    String rationale=chStmt.getString("String_Node_Str");
    if (rationale == null) {
      rationale="String_Node_Str";
    }
    toReturn=factory.createRelationData(version,localId,typeId,modType,aArtId,bArtId,rationale,applicId);
  }
 else {
    if (!historical) {
      logger.warn("String_Node_Str",branchUuid,typeId,aArtId,bArtId,condition.previousGammaId,gammaId);
    }
  }
  return toReturn;
}
Program: 96883
Project: 96883
Buggy source:
@Override protected ValidationResult validate(Artifact artToValidate,IProgressMonitor monitor) throws OseeCoreException {
  Collection<String> errorMessages=new ArrayList<>();
  boolean validationPassed=true;
  if (hasArtifactType(artToValidate.getArtifactType())) {
    List<Artifact> arts=ArtifactQuery.getArtifactListFromTypeWithInheritence(artifactType,artToValidate.getBranch(),DeletionFlag.EXCLUDE_DELETED);
    for (    Artifact art : arts) {
      if (art.getName().equalsIgnoreCase(artToValidate.getName()) && art.getGuid() != artToValidate.getGuid() && !hasGuidPairAlreadyBeenEvaluated(art.getGuid(),artToValidate.getGuid())) {
        if (Strings.isNumeric(artToValidate.getName()) && !artToValidate.getArtifactType().equals(art.getArtifactType())) {
          continue;
        }
        if (isImplementationDetailsChild(artToValidate,art) || isImplementationDetailsChild(art,artToValidate)) {
          continue;
        }
        errorMessages.add(ValidationReportOperation.getRequirementHyperlink(artToValidate) + "String_Node_Str" + ValidationReportOperation.getRequirementHyperlink(art)+ "String_Node_Str"+ artToValidate.getName()+ "String_Node_Str");
        validationPassed=false;
        addGuidPair(art.getGuid(),artToValidate.getGuid());
      }
    }
  }
  return new ValidationResult(errorMessages,validationPassed);
}

Fixed version (ground truth):
@Override protected ValidationResult validate(Artifact artToValidate,IProgressMonitor monitor) throws OseeCoreException {
  Collection<String> errorMessages=new ArrayList<>();
  boolean validationPassed=true;
  if (hasArtifactType(artToValidate.getArtifactType())) {
    List<Artifact> arts=ArtifactQuery.getArtifactListFromTypeWithInheritence(artifactType,artToValidate.getBranch(),DeletionFlag.EXCLUDE_DELETED);
    for (    Artifact art : arts) {
      if (art.getName().equalsIgnoreCase(artToValidate.getName()) && !art.getUuid().equals(artToValidate.getUuid()) && !hasUuidPairAlreadyBeenEvaluated(art.getUuid(),artToValidate.getUuid())) {
        if (Strings.isNumeric(artToValidate.getName()) && !artToValidate.getArtifactType().equals(art.getArtifactType())) {
          continue;
        }
        if (isImplementationDetailsChild(artToValidate,art) || isImplementationDetailsChild(art,artToValidate)) {
          continue;
        }
        errorMessages.add(ValidationReportOperation.getRequirementHyperlink(artToValidate) + "String_Node_Str" + ValidationReportOperation.getRequirementHyperlink(art)+ "String_Node_Str"+ artToValidate.getName()+ "String_Node_Str");
        validationPassed=false;
        addUuidPair(art.getUuid(),artToValidate.getUuid());
      }
    }
  }
  return new ValidationResult(errorMessages,validationPassed);
}
Program: 96885
Project: 96885
Buggy source:
private void executeScript(File vbDiffScript) throws OseeCoreException {
  Process process=null;
  try {
    String target=vbDiffScript.getName();
    String cmd[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + target + "String_Node_Str"};
    ProcessBuilder builder=new ProcessBuilder(cmd);
    File parentDir=vbDiffScript.getParentFile();
    if (parentDir != null) {
      builder.directory(parentDir);
    }
    process=builder.start();
    Thread errorCatcher=new StreamLogger(process.getErrorStream()){
      @Override protected void log(      String message){
        OseeLog.log(Activator.class,OseeLevel.SEVERE_POPUP,message);
      }
    }
;
    Thread outputCatcher=new StreamLogger(process.getInputStream()){
      @Override protected void log(      String message){
        OseeLog.log(Activator.class,Level.INFO,message);
      }
    }
;
    errorCatcher.start();
    outputCatcher.start();
    Long timeoutMs=Long.MAX_VALUE;
    String timeout=OseeInfo.getValue("String_Node_Str");
    if (Strings.isValid(timeout)) {
      timeoutMs=Long.parseLong(timeout);
    }
    if (!process.waitFor(timeoutMs,TimeUnit.MILLISECONDS)) {
      throw new OperationTimedoutException("String_Node_Str");
    }
  }
 catch (  Exception ex) {
    OseeCoreException.wrapAndThrow(ex);
  }
 finally {
    if (process != null) {
      process.destroy();
    }
  }
}

Fixed version (ground truth):
private void executeScript(File vbDiffScript) throws OseeCoreException {
  Process process=null;
  try {
    String target=vbDiffScript.getName();
    String cmd[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + target + "String_Node_Str"};
    ProcessBuilder builder=new ProcessBuilder(cmd);
    File parentDir=vbDiffScript.getParentFile();
    if (parentDir != null) {
      builder.directory(parentDir);
    }
    process=builder.start();
    Thread errorCatcher=new StreamLogger(process.getErrorStream()){
      @Override protected void log(      String message){
        OseeLog.log(Activator.class,OseeLevel.SEVERE_POPUP,message);
      }
    }
;
    Thread outputCatcher=new StreamLogger(process.getInputStream()){
      @Override protected void log(      String message){
        OseeLog.log(Activator.class,Level.INFO,message);
      }
    }
;
    errorCatcher.start();
    outputCatcher.start();
    Long timeoutMs=Long.MAX_VALUE;
    String timeout=null;
    try {
      timeout=OseeInfo.getValue("String_Node_Str");
    }
 catch (    Exception ex) {
      OseeLog.log(Activator.class,Level.INFO,String.format("String_Node_Str",this.getClass().getSimpleName(),timeout));
    }
    if (Strings.isValid(timeout)) {
      timeoutMs=Long.parseLong(timeout);
    }
    if (!process.waitFor(timeoutMs,TimeUnit.MILLISECONDS)) {
      throw new OperationTimedoutException("String_Node_Str");
    }
  }
 catch (  Exception ex) {
    OseeCoreException.wrapAndThrow(ex);
  }
 finally {
    if (process != null) {
      process.destroy();
    }
  }
}
Program: 96886
Project: 96886
Buggy source:
/** 
 * Returns the backing data object for operations like sorting
 */
public Object getBackingData(Object element,XViewerColumn xCol,int columnIndex) throws Exception {
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the backing data object for operations like sorting
 */
public Object getBackingData(Object element,XViewerColumn xCol,int columnIndex) throws Exception {
  if (xCol.getId().equals(AtsColumnId.CreatedDate.getId())) {
    return CreatedDateColumnUI.getInstance().getBackingData(element,xCol,columnIndex);
  }
 else   if (xCol.getId().equals(ReleaseDateColumn.getInstance().getId())) {
    return ReleaseDateColumn.getInstance().getBackingData(element,xCol,columnIndex);
  }
  return null;
}
Program: 96887
Project: 96887
Buggy source:
/** 
 * Provides the XViewerSorter the actual Date object to sort instead of having to convert the text back to Date (and loose the precision)
 */
@Override public Object getBackingData(Object element,XViewerColumn xCol,int columnIndex) throws Exception {
  if (!(element instanceof Change)) {
    return "String_Node_Str";
  }
  Change data=(Change)element;
  if (xCol.getId().equals(HistoryTransactionDateColumn.ID)) {
    Date date=((HistoryXViewerFactory)((HistoryXViewer)xCol.getXViewer()).getXViewerFactory()).getHistoryTransactionDateColumn().getTransactionDate(data.getTxDelta().getEndTx().getId());
    return date;
  }
  return super.getBackingData(element,xCol,columnIndex);
}

Fixed version (ground truth):
/** 
 * Provides the XViewerSorter the actual Date object to sort instead of having to convert the text back to Date (and loose the precision)
 */
@Override public Object getBackingData(Object element,XViewerColumn xCol,int columnIndex) throws Exception {
  if (!(element instanceof Change)) {
    return "String_Node_Str";
  }
  Change data=(Change)element;
  if (xCol.getId().equals(HistoryTransactionDateColumn.ID)) {
    HistoryTransactionDateColumn column=((HistoryXViewerFactory)((HistoryXViewer)xCol.getXViewer()).getXViewerFactory()).getHistoryTransactionDateColumn();
    Date date=column.getTransactionDate(data.getTxDelta().getEndTx().getId());
    if (date == null) {
      column.populateCachedValues(Collections.singleton(element),column.getPreComputedValueMap());
      date=column.getTransactionDate(data.getTxDelta().getEndTx().getId());
    }
    return date;
  }
  return super.getBackingData(element,xCol,columnIndex);
}
Program: 96888
Project: 96888
Buggy source:
@Override public void handleEvent(Event event){
  try {
    Object branchId=event.getProperty(SAFETY_EVENT_BRANCH_ID);
    Object userArt=event.getProperty(SAFETY_EVENT_USER_ART);
    checkEventObjects(branchId,userArt);
    ArtifactReadable assocArt=getAssociatedWorkflowArt((BranchId)branchId);
    IAtsTeamWorkflow safetyWf=getSafetyWorkflow(assocArt);
    if (safetyWf == null) {
      IAtsTeamWorkflow teamWf=atsServer.getWorkItemFactory().getTeamWf(assocArt);
      safetyWf=createSafetyAction(teamWf,(ArtifactReadable)userArt);
    }
  }
 catch (  Exception ex) {
    logger.error(ex,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void handleEvent(Event event){
  try {
    Object branchId=event.getProperty(SAFETY_EVENT_BRANCH_ID);
    Object userArt=event.getProperty(SAFETY_EVENT_USER_ART);
    checkEventObjects(branchId,userArt);
    ArtifactReadable assocArt=getAssociatedWorkflowArt((BranchId)branchId);
    if (assocArt != null) {
      IAtsTeamWorkflow safetyWf=getSafetyWorkflow(assocArt);
      if (safetyWf == null) {
        IAtsTeamWorkflow teamWf=atsServer.getWorkItemFactory().getTeamWf(assocArt);
        safetyWf=createSafetyAction(teamWf,(ArtifactReadable)userArt);
      }
    }
  }
 catch (  Exception ex) {
    logger.error(ex,"String_Node_Str");
  }
}
Program: 96889
Project: 96889
Buggy source:
private ArtifactReadable getAssociatedWorkflowArt(BranchId branchId){
  ArtifactReadable toReturn=null;
  BranchReadable branch=queryFactory.branchQuery().andIds(branchId).getResults().getExactlyOne();
  long workflowUuid=branch.getAssociatedArtifactId();
  try {
    toReturn=atsServer.getQuery().andUuid(workflowUuid).andIsOfType(AtsArtifactTypes.TeamWorkflow).getResults().getExactlyOne();
  }
 catch (  Exception ex) {
    throw new OseeCoreException(ex,"String_Node_Str",workflowUuid);
  }
  return toReturn;
}

Fixed version (ground truth):
private ArtifactReadable getAssociatedWorkflowArt(BranchId branchId){
  ArtifactReadable toReturn=null;
  try {
    BranchReadable branch=queryFactory.branchQuery().andIds(branchId).getResults().getOneOrNull();
    if (branch != null) {
      long workflowUuid=branch.getAssociatedArtifactId();
      toReturn=atsServer.getQuery().andUuid(workflowUuid).andIsOfType(AtsArtifactTypes.TeamWorkflow).getResults().getOneOrNull();
    }
  }
 catch (  Exception ex) {
  }
  return toReturn;
}
Program: 96891
Project: 96891
Buggy source:
@Test public void testGetClientsForUser(){
  String appServer=OseeClientProperties.getOseeApplicationServer();
  URI uri=UriBuilder.fromUri(appServer).path("String_Node_Str").path("String_Node_Str").path("String_Node_Str").build();
  String results=callAndGetResults(uri);
  getExpected("String_Node_Str",results);
}

Fixed version (ground truth):
@Test public void testGetClientsForUser(){
  String appServer=OseeClientProperties.getOseeApplicationServer();
  URI uri=UriBuilder.fromUri(appServer).path("String_Node_Str").path("String_Node_Str").path(DemoUsers.Joe_Smith.getUserId()).build();
  String results=callAndGetResults(uri);
  getExpected("String_Node_Str" + DemoUsers.Joe_Smith.getUserId() + "String_Node_Str",results);
  uri=UriBuilder.fromUri(appServer + "String_Node_Str").build();
  results=callAndGetResults(uri);
  getExpected("String_Node_Str" + DemoUsers.Joe_Smith.getUserId() + "String_Node_Str",results);
}