nus-yam/ex-repair huggingface dataset:
Program: 97429
Project: 97429
Buggy source:
@Test public void test() throws Exception {
  SevereLoggingMonitor monitor=TestUtil.severeLoggingStart();
  AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
  Assert.assertFalse(AtsUsersClient.getOseeUser().getRelatedArtifacts(AtsRelationTypes.FavoriteUser_Artifact).contains(AtsTestUtil.getTeamWf()));
  ResourceHistoryAction action=createAction();
  action.runWithException();
  TestUtil.severeLoggingEnd(monitor);
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  SevereLoggingMonitor monitor=TestUtil.severeLoggingStart();
  AtsTestUtil.cleanupAndReset(getClass().getSimpleName());
  Assert.assertFalse(AtsClientService.get().getUserAdmin().getCurrentOseeUser().getRelatedArtifacts(AtsRelationTypes.FavoriteUser_Artifact).contains(AtsTestUtil.getTeamWf()));
  ResourceHistoryAction action=createAction();
  action.runWithException();
  TestUtil.severeLoggingEnd(monitor);
}
Program: 97430
Project: 97430
Buggy source:
IAtsWorkDefinition copyWorkDefinition(String newName,IAtsWorkDefinition workDef,XResultData resultData,IAttributeResolver resolver,IUserResolver iUserResolver);

Fixed version (ground truth):
IAtsWorkDefinition copyWorkDefinition(String newName,IAtsWorkDefinition workDef,XResultData resultData);
Program: 97432
Project: 97432
Buggy source:
@Override protected void doWork(IProgressMonitor monitor) throws Exception {
  VCastDataStore dataStore=VCastDataStoreFactory.createDataStore(input.getVCastDbPath());
  Map<String,CoverageUnit> fileNumToCoverageUnit=new HashMap<String,CoverageUnit>();
  coverageImport.setCoverageUnitFileContentsProvider(new SimpleCoverageUnitFileContentsProvider());
  Collection<VCastInstrumentedFile> instrumentedFiles=getInstrumentedFiles(dataStore);
  for (  VCastInstrumentedFile instrumentedFile : instrumentedFiles) {
    checkForCancelledStatus(monitor);
    processInstrumented(monitor,dataStore,fileNumToCoverageUnit,instrumentedFile);
  }
  Collection<VCastResult> results=getResultFiles(dataStore);
  for (  VCastResult result : results) {
    checkForCancelledStatus(monitor);
    processResult(monitor,fileNumToCoverageUnit,result);
  }
  monitor.worked(1);
}

Fixed version (ground truth):
@Override protected void doWork(IProgressMonitor monitor) throws Exception {
  File file=new File(input.getVCastDirectory() + input.getVCastDbPath());
  if (file.exists() && file.canRead()) {
    VCastDataStore dataStore=VCastDataStoreFactory.createDataStore(file.getAbsolutePath());
    Map<String,CoverageUnit> fileNumToCoverageUnit=new HashMap<String,CoverageUnit>();
    coverageImport.setCoverageUnitFileContentsProvider(new SimpleCoverageUnitFileContentsProvider());
    Collection<VCastInstrumentedFile> instrumentedFiles=getInstrumentedFiles(dataStore);
    for (    VCastInstrumentedFile instrumentedFile : instrumentedFiles) {
      checkForCancelledStatus(monitor);
      processInstrumented(monitor,dataStore,fileNumToCoverageUnit,instrumentedFile);
    }
    Collection<VCastResult> results=getResultFiles(dataStore);
    for (    VCastResult result : results) {
      checkForCancelledStatus(monitor);
      processResult(monitor,fileNumToCoverageUnit,result);
    }
    monitor.worked(1);
  }
 else {
    throw new OseeCoreException("String_Node_Str",file.getAbsolutePath());
  }
}
Program: 97435
Project: 97435
Buggy source:
private void setFromPropertyStore(PropertyStore store,CoverageOptionManager coverageOptionManager) throws OseeCoreException {
  setCoverageMethod(coverageOptionManager.get(store.get("String_Node_Str")));
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setOrderNumber(store.get("String_Node_Str"));
  }
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setName(Strings.intern(store.get("String_Node_Str")));
  }
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setRationale(store.get("String_Node_Str"));
  }
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setWorkProductTaskGuid(store.get("String_Node_Str"));
  }
  if (testUnitProvider == null) {
    testUnitProvider=new SimpleTestUnitProvider();
  }
  String testUnitsStr=store.get("String_Node_Str");
  if (Strings.isValid(testUnitsStr)) {
    testUnitProvider.fromXml(this,testUnitsStr);
  }
}

Fixed version (ground truth):
private void setFromPropertyStore(PropertyStore store,CoverageOptionManager coverageOptionManager) throws OseeCoreException {
  String methodTypeString=store.get("String_Node_Str");
  CoverageOption coverageMethod=coverageOptionManager.get(methodTypeString);
  Conditions.checkNotNull(coverageMethod,String.format("String_Node_Str",methodTypeString));
  setCoverageMethod(coverageMethod);
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setOrderNumber(store.get("String_Node_Str"));
  }
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setName(Strings.intern(store.get("String_Node_Str")));
  }
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setRationale(store.get("String_Node_Str"));
  }
  if (Strings.isValid(store.get("String_Node_Str"))) {
    setWorkProductTaskGuid(store.get("String_Node_Str"));
  }
  if (testUnitProvider == null) {
    testUnitProvider=new SimpleTestUnitProvider();
  }
  String testUnitsStr=store.get("String_Node_Str");
  if (Strings.isValid(testUnitsStr)) {
    testUnitProvider.fromXml(this,testUnitsStr);
  }
}
Program: 97436
Project: 97436
Buggy source:
public List<CoverageItem> getCoverageItemsCovered(){
  List<CoverageItem> items=new ArrayList<CoverageItem>();
  for (  CoverageItem coverageItem : getCoverageItems()) {
    if (coverageItem.getCoverageMethod() == null) {
      OseeLog.log(Activator.class,Level.SEVERE,String.format("String_Node_Str",coverageItem.toString()));
      System.out.println("String_Node_Str");
    }
 else     if (!coverageItem.getCoverageMethod().getName().equals(CoverageOptionManager.Not_Covered.name)) {
      items.add(coverageItem);
    }
  }
  return items;
}

Fixed version (ground truth):
public List<CoverageItem> getCoverageItemsCovered(){
  List<CoverageItem> items=new ArrayList<CoverageItem>();
  for (  CoverageItem coverageItem : getCoverageItems()) {
    if (coverageItem.getCoverageMethod() == null) {
      OseeLog.log(Activator.class,Level.SEVERE,String.format("String_Node_Str",coverageItem.toString()));
    }
 else     if (!coverageItem.getCoverageMethod().getName().equals(CoverageOptionManager.Not_Covered.name)) {
      items.add(coverageItem);
    }
  }
  return items;
}
Program: 97437
Project: 97437
Buggy source:
@Override public void dispose(){
  labelWidget.dispose();
  if (Widgets.isAccessible(parent)) {
    parent.layout();
  }
}

Fixed version (ground truth):
@Override public void dispose(){
  if (Widgets.isAccessible(labelWidget)) {
    labelWidget.dispose();
  }
  if (Widgets.isAccessible(parent)) {
    parent.layout();
  }
}
Program: 97438
Project: 97438
Buggy source:
public void removeControlCausedMessageByObject(){
  IMessageManager messageManager=getMessageManager();
  if (messageManager != null && isFormReady()) {
    messageManager.removeMessage(this,getErrorMessageControl());
  }
}

Fixed version (ground truth):
public void removeControlCausedMessageByObject(){
  IMessageManager messageManager=getMessageManager();
  if (messageManager != null && isFormReady()) {
    if (Widgets.isAccessible(getErrorMessageControl())) {
      messageManager.removeMessage(this,getErrorMessageControl());
    }
  }
}
Program: 97439
Project: 97439
Buggy source:
public void removeControlCausedMessage(String messageId){
  IMessageManager messageManager=getMessageManager();
  if (messageManager != null && isFormReady()) {
    messageManager.removeMessage(messageId,getErrorMessageControl());
  }
}

Fixed version (ground truth):
public void removeControlCausedMessage(String messageId){
  IMessageManager messageManager=getMessageManager();
  if (messageManager != null && isFormReady()) {
    if (Widgets.isAccessible(getErrorMessageControl())) {
      messageManager.removeMessage(messageId,getErrorMessageControl());
    }
  }
}
Program: 97440
Project: 97440
Buggy source:
@Override public void cancel() throws OseeCoreException {
  try {
    if (preparedStatement != null) {
      preparedStatement.cancel();
    }
    if (callableStatement != null) {
      callableStatement.cancel();
    }
  }
 catch (  SQLException ex) {
    OseeExceptions.wrapAndThrow(ex);
  }
}

Fixed version (ground truth):
@Override public void cancel() throws OseeCoreException {
  try {
    if (preparedStatement != null && !preparedStatement.isClosed()) {
      preparedStatement.cancel();
    }
  }
 catch (  SQLException ex) {
    OseeExceptions.wrapAndThrow(ex);
  }
  try {
    if (callableStatement != null && !callableStatement.isClosed()) {
      callableStatement.cancel();
    }
  }
 catch (  SQLException ex) {
    OseeExceptions.wrapAndThrow(ex);
  }
}
Program: 97441
Project: 97441
Buggy source:
private void closePreviousResources() throws OseeCoreException {
  try {
    if (rSet != null) {
      rSet.close();
    }
    if (preparedStatement != null) {
      preparedStatement.close();
    }
    if (callableStatement != null) {
      callableStatement.close();
    }
  }
 catch (  SQLException ex) {
    OseeExceptions.wrapAndThrow(ex);
  }
}

Fixed version (ground truth):
private void closePreviousResources(){
  try {
    if (rSet != null) {
      rSet.close();
    }
  }
 catch (  SQLException ex) {
    OseeLog.log(OseeStatementImpl.class,Level.SEVERE,ex);
  }
 finally {
    rSet=null;
  }
  try {
    if (preparedStatement != null && !preparedStatement.isClosed()) {
      preparedStatement.close();
    }
  }
 catch (  SQLException ex) {
    OseeLog.log(OseeStatementImpl.class,Level.SEVERE,ex);
  }
 finally {
    preparedStatement=null;
  }
  try {
    if (callableStatement != null && !callableStatement.isClosed()) {
      callableStatement.close();
    }
  }
 catch (  SQLException ex) {
    OseeLog.log(OseeStatementImpl.class,Level.SEVERE,ex);
  }
 finally {
    callableStatement=null;
  }
}
Program: 97442
Project: 97442
Buggy source:
@Override public boolean isDatabaseType(SupportedDatabase type) throws OseeCoreException {
  return SupportedDatabase.isDatabaseType(connection.getMetaData(),type);
}

Fixed version (ground truth):
@Override public boolean isDatabaseType(SupportedDatabase type) throws OseeCoreException {
  allowReuse();
  return SupportedDatabase.isDatabaseType(connection.getMetaData(),type);
}
Program: 97443
Project: 97443
Buggy source:
/** 
 * The application must call close when it is done using this object; however, it is safe to use this same object multiple times, for example calling runPreparedQuery() repeatedly, without any intermediate calls to close
 */
@Override public void close(){
  try {
    closePreviousResources();
    if (autoClose && connection != null) {
      connection.close();
      connection=null;
    }
  }
 catch (  OseeCoreException ex) {
    OseeLog.log(OseeStatementImpl.class,Level.SEVERE,ex);
  }
}

Fixed version (ground truth):
/** 
 * The application must call close when it is done using this object; however, it is safe to use this same object multiple times, for example calling runPreparedQuery() repeatedly, without any intermediate calls to close
 */
@Override public void close(){
  closePreviousResources();
  if (autoClose && connection != null) {
    try {
      if (!connection.isClosed()) {
        connection.close();
      }
    }
 catch (    OseeCoreException ex) {
      OseeLog.log(OseeStatementImpl.class,Level.SEVERE,ex);
    }
 finally {
      connection=null;
    }
  }
}
Program: 97444
Project: 97444
Buggy source:
/** 
 * allows for multiple uses of this object to have an open connection
 */
private void allowReuse() throws OseeCoreException {
  if (connection == null) {
    connection=connectionPool.getConnection();
  }
  closePreviousResources();
}

Fixed version (ground truth):
/** 
 * allows for multiple uses of this object to have an open connection
 */
private void allowReuse() throws OseeCoreException {
  closePreviousResources();
  if (connection == null) {
    connection=connectionPool.getConnection();
  }
}
Program: 97445
Project: 97445
Buggy source:
private void processAddressedButNonexistentGammas(String tableName) throws OseeCoreException {
  List<Object[]> nonexistentGammas=new LinkedList<Object[]>();
  IOseeStatement chStmt=getDatabaseService().getStatement();
  try {
    String sql=String.format(NONEXISTENT_GAMMAS,tableName);
    chStmt.runPreparedQuery(sql);
    while (chStmt.next()) {
      nonexistentGammas.add(new Object[]{chStmt.getInt("String_Node_Str")});
      log(String.valueOf(chStmt.getInt("String_Node_Str")));
    }
  }
  finally {
    chStmt.close();
  }
  getDatabaseService().runBatchUpdate(String.format(DELETE_GAMMAS,tableName),nonexistentGammas);
}

Fixed version (ground truth):
private void processAddressedButNonexistentGammas(OseeConnection connection,String tableName) throws OseeCoreException {
  List<Object[]> nonexistentGammas=new LinkedList<Object[]>();
  IOseeStatement chStmt=getDatabaseService().getStatement(connection);
  try {
    String sql=String.format(NONEXISTENT_GAMMAS,tableName);
    chStmt.runPreparedQuery(sql);
    while (chStmt.next()) {
      nonexistentGammas.add(new Object[]{chStmt.getInt("String_Node_Str")});
      log(String.valueOf(chStmt.getInt("String_Node_Str")));
    }
  }
  finally {
    chStmt.close();
  }
  if (!nonexistentGammas.isEmpty()) {
    getDatabaseService().runBatchUpdate(connection,String.format(DELETE_GAMMAS,tableName),nonexistentGammas);
  }
}
Program: 97446
Project: 97446
Buggy source:
public PurgeUnusedBackingDataAndTransactions(IOseeDatabaseService dbService,OperationLogger logger){
  super("String_Node_Str",ServiceUtil.PLUGIN_ID,logger);
  this.dbService=dbService;
}

Fixed version (ground truth):
public PurgeUnusedBackingDataAndTransactions(IOseeDatabaseService dbService,OperationLogger logger){
  super(dbService,"String_Node_Str",ServiceUtil.PLUGIN_ID,logger);
}
Program: 97447
Project: 97447
Buggy source:
private void processEmptyTransactions() throws OseeCoreException {
  List<Object[]> emptyTransactions=new LinkedList<Object[]>();
  IOseeStatement chStmt=ConnectionHandler.getStatement();
  String sql=EMPTY_TRANSACTIONS;
  try {
    chStmt.runPreparedQuery(sql);
    while (chStmt.next()) {
      emptyTransactions.add(new Object[]{chStmt.getInt("String_Node_Str"),chStmt.getInt("String_Node_Str")});
      log(String.valueOf(chStmt.getInt("String_Node_Str")));
    }
  }
  finally {
    chStmt.close();
  }
  ConnectionHandler.runBatchUpdate(DELETE_EMPTY_TRANSACTIONS,emptyTransactions);
}

Fixed version (ground truth):
private void processEmptyTransactions(OseeConnection connection) throws OseeCoreException {
  List<Object[]> emptyTransactions=new LinkedList<Object[]>();
  IOseeStatement chStmt=getDatabaseService().getStatement(connection);
  try {
    chStmt.runPreparedQuery(EMPTY_TRANSACTIONS);
    while (chStmt.next()) {
      emptyTransactions.add(new Object[]{chStmt.getInt("String_Node_Str"),chStmt.getInt("String_Node_Str")});
      log(String.valueOf(chStmt.getInt("String_Node_Str")));
    }
  }
  finally {
    chStmt.close();
  }
  if (!emptyTransactions.isEmpty()) {
    getDatabaseService().runBatchUpdate(connection,DELETE_EMPTY_TRANSACTIONS,emptyTransactions);
  }
}
Program: 97448
Project: 97448
Buggy source:
private void processNotAddressedGammas(String tableName) throws OseeCoreException {
  List<Object[]> notAddressedGammas=new LinkedList<Object[]>();
  IOseeStatement chStmt=ConnectionHandler.getStatement();
  String sql=String.format(NOT_ADDRESSESED_GAMMAS,tableName);
  try {
    chStmt.runPreparedQuery(sql);
    while (chStmt.next()) {
      notAddressedGammas.add(new Object[]{chStmt.getLong("String_Node_Str")});
      log(String.valueOf(chStmt.getLong("String_Node_Str")));
    }
  }
  finally {
    chStmt.close();
  }
  sql=String.format(DELETE_GAMMAS,tableName);
  getDatabaseService().runBatchUpdate(sql,notAddressedGammas);
}

Fixed version (ground truth):
private void processNotAddressedGammas(OseeConnection connection,String tableName) throws OseeCoreException {
  List<Object[]> notAddressedGammas=new LinkedList<Object[]>();
  IOseeStatement chStmt=getDatabaseService().getStatement(connection);
  try {
    String sql=String.format(NOT_ADDRESSESED_GAMMAS,tableName);
    chStmt.runPreparedQuery(sql);
    while (chStmt.next()) {
      notAddressedGammas.add(new Object[]{chStmt.getLong("String_Node_Str")});
      log(String.valueOf(chStmt.getLong("String_Node_Str")));
    }
  }
  finally {
    chStmt.close();
  }
  if (!notAddressedGammas.isEmpty()) {
    getDatabaseService().runBatchUpdate(connection,String.format(DELETE_GAMMAS,tableName),notAddressedGammas);
  }
}
Program: 97449
Project: 97449
Buggy source:
@Override protected void doWork(IProgressMonitor monitor) throws Exception {
  Conditions.checkNotNull(artifactData,"String_Node_Str");
  Artifact artifact=artifactData.getArtifact();
  Conditions.checkNotNull(artifactData,"String_Node_Str");
  if (artifact.isDeleted()) {
    throw new OseeStateException("String_Node_Str",artifact.getName());
  }
 else {
    if (artifact.isHistorical()) {
      artifactData.setArtifact(ArtifactQuery.getArtifactFromId(artifact.getArtId(),artifact.getBranch(),DeletionFlag.EXCLUDE_DELETED));
    }
    Artifact root=OseeSystemArtifacts.getDefaultHierarchyRootArtifact(artifact.getBranch());
    Artifact artifactRoot=artifact.getArtifactRoot();
    if (!root.equals(artifactRoot)) {
      String artifactRootName=artifactRoot != null ? artifactRoot.getName() : artifact.getName();
      throw new OseeStateException("String_Node_Str",artifact.getName(),artifactRootName);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWork(IProgressMonitor monitor) throws Exception {
  Conditions.checkNotNull(artifactData,"String_Node_Str");
  Artifact artifact=artifactData.getArtifact();
  Conditions.checkNotNull(artifact,"String_Node_Str");
  if (artifact.isDeleted()) {
    throw new OseeStateException("String_Node_Str",artifact.getName());
  }
 else {
    if (artifact.isHistorical()) {
      artifactData.setArtifact(ArtifactQuery.getArtifactFromId(artifact.getArtId(),artifact.getBranch(),DeletionFlag.EXCLUDE_DELETED));
    }
    if (artifact.isNotRootedInDefaultRoot()) {
      throw new OseeStateException("String_Node_Str",artifact.getName());
    }
  }
}
Program: 97450
Project: 97450
Buggy source:
@Override public StyledString getStyledText(Object element){
  if (element instanceof AttributeLineElement) {
    return getLineElementLabel((AttributeLineElement)element);
  }
  if (!(element instanceof Artifact)) {
    return new StyledString(String.format("String_Node_Str",element.getClass(),element));
  }
  Artifact artifact=(Artifact)element;
  String name=artifact.getName();
  int matchCount=getMatchCount(artifact);
  if (matchCount > 0) {
    StyledString artifactString=getColoredLabelWithCounts(artifact,matchCount,new StyledString(name));
    return getArtifactText(artifactDecorator,artifact,artifactString);
  }
 else {
    return new StyledString(name,StyledString.DECORATIONS_STYLER);
  }
}

Fixed version (ground truth):
@Override public StyledString getStyledText(Object element){
  if (element instanceof FakeArtifactParent) {
    return new StyledString(((FakeArtifactParent)element).getName());
  }
  if (element instanceof AttributeLineElement) {
    return getLineElementLabel((AttributeLineElement)element);
  }
  if (!(element instanceof Artifact)) {
    return new StyledString(String.format("String_Node_Str",element.getClass(),element));
  }
  Artifact artifact=(Artifact)element;
  String name=artifact.getName();
  int matchCount=getMatchCount(artifact);
  if (matchCount > 0) {
    StyledString artifactString=getColoredLabelWithCounts(artifact,matchCount,new StyledString(name));
    return getArtifactText(artifactDecorator,artifact,artifactString);
  }
 else {
    return new StyledString(name,StyledString.DECORATIONS_STYLER);
  }
}
Program: 97451
Project: 97451
Buggy source:
@Override public Image getImage(Object element){
  Image toReturn=null;
  if (element instanceof AttributeLineElement) {
    toReturn=ImageManager.getImage(FrameworkImage.LINE_MATCH);
  }
 else   if (element instanceof Artifact) {
    Image artImage=ArtifactImageManager.getImage((Artifact)element);
    int matchCount=getMatchCount(element);
    if (matchCount > 0) {
      toReturn=artImage;
    }
 else {
      Image disabledImage=disabledImageMap.get(artImage);
      if (disabledImage == null) {
        disabledImage=new Image(artImage.getDevice(),artImage,SWT.IMAGE_DISABLE);
        disabledImageMap.put(artImage,disabledImage);
      }
      toReturn=disabledImage;
    }
  }
  return toReturn;
}

Fixed version (ground truth):
@Override public Image getImage(Object element){
  Image toReturn=null;
  if (element instanceof FakeArtifactParent) {
    toReturn=PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
  }
 else   if (element instanceof AttributeLineElement) {
    toReturn=ImageManager.getImage(FrameworkImage.LINE_MATCH);
  }
 else   if (element instanceof Artifact) {
    Image artImage=ArtifactImageManager.getImage((Artifact)element);
    int matchCount=getMatchCount(element);
    if (matchCount > 0) {
      toReturn=artImage;
    }
 else {
      Image disabledImage=disabledImageMap.get(artImage);
      if (disabledImage == null) {
        disabledImage=new Image(artImage.getDevice(),artImage,SWT.IMAGE_DISABLE);
        disabledImageMap.put(artImage,disabledImage);
      }
      toReturn=disabledImage;
    }
  }
  return toReturn;
}
Program: 97452
Project: 97452
Buggy source:
private int getElementLimit(){
  return fPage.getElementLimit().intValue();
}

Fixed version (ground truth):
private int getElementLimit(){
  return searchPage.getElementLimit().intValue();
}
Program: 97453
Project: 97453
Buggy source:
@Override public Object getParent(Object element){
  if (element instanceof AttributeLineElement) {
    return ((AttributeLineElement)element).getParent();
  }
  if (element instanceof AttributeMatch) {
    AttributeMatch match=(AttributeMatch)element;
    return match.getArtifact();
  }
  if (element instanceof Artifact) {
    Artifact resource=(Artifact)element;
    try {
      return resource.getParent();
    }
 catch (    OseeCoreException ex) {
      OseeLog.log(Activator.class,Level.SEVERE,ex);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getParent(Object element){
  Object toReturn=null;
  if (element instanceof AttributeLineElement) {
    toReturn=((AttributeLineElement)element).getParent();
  }
 else   if (element instanceof AttributeMatch) {
    AttributeMatch match=(AttributeMatch)element;
    toReturn=match.getArtifact();
  }
 else   if (element instanceof Artifact) {
    Artifact resource=(Artifact)element;
    try {
      toReturn=resource.getParent();
      if (toReturn == null && resource.isNotRootedInDefaultRoot()) {
        toReturn=orphanParent;
      }
    }
 catch (    MultipleArtifactsExist ex) {
      toReturn=multiParent;
    }
catch (    OseeCoreException ex) {
      OseeLog.log(Activator.class,Level.SEVERE,ex);
    }
  }
  return toReturn;
}
Program: 97454
Project: 97454
Buggy source:
private void removeFromSiblings(Object element,Object parent){
  Set<?> siblings=fChildrenMap.get(parent);
  if (siblings != null) {
    siblings.remove(element);
  }
}

Fixed version (ground truth):
private void removeFromSiblings(Object element,Object parent){
  Set<?> siblings=childrenMap.get(parent);
  if (siblings != null) {
    siblings.remove(element);
  }
}
Program: 97455
Project: 97455
Buggy source:
@Override public void clear(){
  initialize(fResult);
  fTreeViewer.refresh();
}

Fixed version (ground truth):
@Override public void clear(){
  initialize(searchResult);
  treeViewer.refresh();
}
Program: 97456
Project: 97456
Buggy source:
private void insert(Object child,boolean refreshViewer){
  Object parent=getParent(child);
  while (parent != null) {
    if (insertChild(parent,child)) {
      if (refreshViewer) {
        fTreeViewer.add(parent,child);
      }
    }
 else {
      if (refreshViewer) {
        fTreeViewer.refresh(parent);
      }
      return;
    }
    child=parent;
    parent=getParent(child);
  }
  if (insertChild(fResult,child)) {
    if (refreshViewer) {
      fTreeViewer.add(fResult,child);
    }
  }
}

Fixed version (ground truth):
private void insert(Object child,boolean refreshViewer){
  Object parent=getParent(child);
  while (parent != null) {
    if (insertChild(parent,child)) {
      if (refreshViewer) {
        treeViewer.add(parent,child);
      }
    }
 else {
      if (refreshViewer) {
        treeViewer.refresh(parent);
      }
      return;
    }
    child=parent;
    parent=getParent(child);
  }
  if (insertChild(searchResult,child)) {
    if (refreshViewer) {
      treeViewer.add(searchResult,child);
    }
  }
}
Program: 97457
Project: 97457
Buggy source:
/** 
 * returns true if the child already was a child of parent.
 * @return Returns <code>true</code> if the child was added
 */
@SuppressWarnings("String_Node_Str") private boolean insertChild(Object parent,Object child){
  Set<Object> children=fChildrenMap.get(parent);
  if (children == null) {
    children=new HashSet<Object>();
    fChildrenMap.put(parent,children);
  }
  return children.add(child);
}

Fixed version (ground truth):
/** 
 * returns true if the child already was a child of parent.
 * @return Returns <code>true</code> if the child was added
 */
@SuppressWarnings("String_Node_Str") private boolean insertChild(Object parent,Object child){
  Set<Object> children=childrenMap.get(parent);
  if (children == null) {
    children=new HashSet<Object>();
    childrenMap.put(parent,children);
  }
  return children.add(child);
}
Program: 97458
Project: 97458
Buggy source:
private void remove(Object element,boolean refreshViewer){
  if (hasChildren(element)) {
    if (refreshViewer) {
      fTreeViewer.refresh(element);
    }
  }
 else {
    if (!hasMatches(element)) {
      fChildrenMap.remove(element);
      Object parent=getParent(element);
      if (parent != null) {
        removeFromSiblings(element,parent);
        remove(parent,refreshViewer);
      }
 else {
        removeFromSiblings(element,fResult);
        if (refreshViewer) {
          fTreeViewer.refresh();
        }
      }
    }
 else {
      if (refreshViewer) {
        fTreeViewer.refresh(element);
      }
    }
  }
}

Fixed version (ground truth):
private void remove(Object element,boolean refreshViewer){
  if (hasChildren(element)) {
    if (refreshViewer) {
      treeViewer.refresh(element);
    }
  }
 else {
    if (!hasMatches(element)) {
      childrenMap.remove(element);
      Object parent=getParent(element);
      if (parent != null) {
        removeFromSiblings(element,parent);
        remove(parent,refreshViewer);
      }
 else {
        removeFromSiblings(element,searchResult);
        if (refreshViewer) {
          treeViewer.refresh();
        }
      }
    }
 else {
      if (refreshViewer) {
        treeViewer.refresh(element);
      }
    }
  }
}
Program: 97459
Project: 97459
Buggy source:
ArtifactTreeContentProvider(ArtifactSearchPage page,AbstractTreeViewer viewer){
  fPage=page;
  fTreeViewer=viewer;
}

Fixed version (ground truth):
ArtifactTreeContentProvider(ArtifactSearchPage page,AbstractTreeViewer viewer){
  searchPage=page;
  treeViewer=viewer;
}
Program: 97460
Project: 97460
Buggy source:
@Override public synchronized void elementsChanged(Object[] updatedElements){
  for (int i=0; i < updatedElements.length; i++) {
    if (!(updatedElements[i] instanceof AttributeLineElement)) {
      if (fResult.getMatchCount(updatedElements[i]) > 0) {
        insert(updatedElements[i],true);
      }
 else {
        remove(updatedElements[i],true);
      }
    }
 else {
      AttributeLineElement lineElement=(AttributeLineElement)updatedElements[i];
      int nMatches=lineElement.getNumberOfMatches(fResult);
      if (nMatches > 0) {
        if (hasChild(lineElement.getParent(),lineElement)) {
          fTreeViewer.update(new Object[]{lineElement,lineElement.getParent()},null);
        }
 else {
          insert(lineElement,true);
        }
      }
 else {
        remove(lineElement,true);
      }
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void elementsChanged(Object[] updatedElements){
  for (int i=0; i < updatedElements.length; i++) {
    if (!(updatedElements[i] instanceof AttributeLineElement)) {
      if (searchResult.getMatchCount(updatedElements[i]) > 0) {
        insert(updatedElements[i],true);
      }
 else {
        remove(updatedElements[i],true);
      }
    }
 else {
      AttributeLineElement lineElement=(AttributeLineElement)updatedElements[i];
      int nMatches=lineElement.getNumberOfMatches(searchResult);
      if (nMatches > 0) {
        if (hasChild(lineElement.getParent(),lineElement)) {
          treeViewer.update(new Object[]{lineElement,lineElement.getParent()},null);
        }
 else {
          insert(lineElement,true);
        }
      }
 else {
        remove(lineElement,true);
      }
    }
  }
}
Program: 97461
Project: 97461
Buggy source:
@Override public Object[] getChildren(Object parentElement){
  Set<?> children=fChildrenMap.get(parentElement);
  if (children == null) {
    return EMPTY_ARR;
  }
  return children.toArray();
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object parentElement){
  Set<?> children=childrenMap.get(parentElement);
  if (children == null) {
    return EMPTY_ARR;
  }
  return children.toArray();
}
Program: 97462
Project: 97462
Buggy source:
private boolean hasChild(Object parent,Object child){
  Set<?> children=fChildrenMap.get(parent);
  return children != null && children.contains(child);
}

Fixed version (ground truth):
private boolean hasChild(Object parent,Object child){
  Set<?> children=childrenMap.get(parent);
  return children != null && children.contains(child);
}
Program: 97463
Project: 97463
Buggy source:
@SuppressWarnings("String_Node_Str") private synchronized void initialize(AbstractArtifactSearchResult result){
  fResult=result;
  fChildrenMap=new HashMap<Object,Set>();
  boolean showLineMatches=fResult.hasAttributeMatches();
  if (result != null) {
    Object[] elements=result.getElements();
    for (int i=0; i < elements.length; i++) {
      if (showLineMatches) {
        Match[] matches=result.getMatches(elements[i]);
        for (int j=0; j < matches.length; j++) {
          Match match=matches[j];
          if (match instanceof AttributeMatch) {
            insert(((AttributeMatch)match).getLineElement(),false);
          }
 else {
            insert(match.getElement(),false);
          }
        }
      }
 else {
        insert(elements[i],false);
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private synchronized void initialize(AbstractArtifactSearchResult result){
  searchResult=result;
  childrenMap=new HashMap<Object,Set>();
  boolean showLineMatches=searchResult.hasAttributeMatches();
  if (result != null) {
    Object[] elements=result.getElements();
    for (int i=0; i < elements.length; i++) {
      if (showLineMatches) {
        Match[] matches=result.getMatches(elements[i]);
        for (int j=0; j < matches.length; j++) {
          Match match=matches[j];
          if (match instanceof AttributeMatch) {
            insert(((AttributeMatch)match).getLineElement(),false);
          }
 else {
            insert(match.getElement(),false);
          }
        }
      }
 else {
        insert(elements[i],false);
      }
    }
  }
}
Program: 97464
Project: 97464
Buggy source:
private boolean hasMatches(Object element){
  if (element instanceof AttributeLineElement) {
    AttributeLineElement lineElement=(AttributeLineElement)element;
    return lineElement.getNumberOfMatches(fResult) > 0;
  }
  return fResult.getMatchCount(element) > 0;
}

Fixed version (ground truth):
private boolean hasMatches(Object element){
  if (element instanceof AttributeLineElement) {
    AttributeLineElement lineElement=(AttributeLineElement)element;
    return lineElement.getNumberOfMatches(searchResult) > 0;
  }
  return searchResult.getMatchCount(element) > 0;
}
Program: 97466
Project: 97466
Buggy source:
public static void logWorkflowCancelledEvent(AbstractWorkflowArtifact awa,String fromStateName,String reason,Date cancelDate,IAtsUser cancelBy) throws OseeCoreException {
  awa.getLog().addLog(LogType.StateCancelled,fromStateName,reason,cancelDate,cancelBy);
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledBy,cancelBy.getUserId());
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledDate,cancelDate);
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledReason,reason);
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledFromState,fromStateName);
  }
}

Fixed version (ground truth):
public static void logWorkflowCancelledEvent(AbstractWorkflowArtifact awa,IAtsStateDefinition fromState,IAtsStateDefinition toState,String reason,Date cancelDate,IAtsUser cancelBy) throws OseeCoreException {
  awa.getLog().addLog(LogType.StateCancelled,fromState.getName(),reason,cancelDate,cancelBy);
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledBy,cancelBy.getUserId());
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledDate,cancelDate);
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledReason,reason);
    awa.setSoleAttributeValue(AtsAttributeTypes.CancelledFromState,fromState.getName());
  }
  validateUpdatePercentCompleteAttribute(awa,toState);
}
Program: 97467
Project: 97467
Buggy source:
public static void logWorkflowUnCompletedEvent(AbstractWorkflowArtifact awa) throws OseeCoreException {
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.deleteSoleAttribute(AtsAttributeTypes.CompletedBy);
    awa.deleteSoleAttribute(AtsAttributeTypes.CompletedDate);
    awa.deleteSoleAttribute(AtsAttributeTypes.CompletedFromState);
  }
}

Fixed version (ground truth):
public static void logWorkflowUnCompletedEvent(AbstractWorkflowArtifact awa,IAtsStateDefinition toState) throws OseeCoreException {
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.deleteSoleAttribute(AtsAttributeTypes.CompletedBy);
    awa.deleteSoleAttribute(AtsAttributeTypes.CompletedDate);
    awa.deleteSoleAttribute(AtsAttributeTypes.CompletedFromState);
  }
  validateUpdatePercentCompleteAttribute(awa,toState);
}
Program: 97468
Project: 97468
Buggy source:
private void logWorkflowCompletedEvent(AbstractWorkflowArtifact awa,String fromStateName,String reason,Date cancelDate,IAtsUser cancelBy) throws OseeCoreException {
  awa.getLog().addLog(LogType.StateComplete,fromStateName,Strings.isValid(reason) ? reason : "String_Node_Str",cancelDate,cancelBy);
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.setSoleAttributeValue(AtsAttributeTypes.CompletedBy,cancelBy.getUserId());
    awa.setSoleAttributeValue(AtsAttributeTypes.CompletedDate,cancelDate);
    awa.setSoleAttributeValue(AtsAttributeTypes.CompletedFromState,fromStateName);
  }
}

Fixed version (ground truth):
private void logWorkflowCompletedEvent(AbstractWorkflowArtifact awa,IAtsStateDefinition fromState,IAtsStateDefinition toState,String reason,Date cancelDate,IAtsUser cancelBy) throws OseeCoreException {
  awa.getLog().addLog(LogType.StateComplete,fromState.getName(),Strings.isValid(reason) ? reason : "String_Node_Str",cancelDate,cancelBy);
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.setSoleAttributeValue(AtsAttributeTypes.CompletedBy,cancelBy.getUserId());
    awa.setSoleAttributeValue(AtsAttributeTypes.CompletedDate,cancelDate);
    awa.setSoleAttributeValue(AtsAttributeTypes.CompletedFromState,fromState.getName());
  }
  validateUpdatePercentCompleteAttribute(awa,toState);
}
Program: 97469
Project: 97469
Buggy source:
public static void logWorkflowUnCancelledEvent(AbstractWorkflowArtifact awa) throws OseeCoreException {
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledBy);
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledDate);
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledReason);
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledFromState);
  }
}

Fixed version (ground truth):
public static void logWorkflowUnCancelledEvent(AbstractWorkflowArtifact awa,IAtsStateDefinition toState) throws OseeCoreException {
  if (awa.isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledBy);
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledDate);
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledReason);
    awa.deleteSoleAttribute(AtsAttributeTypes.CancelledFromState);
  }
  validateUpdatePercentCompleteAttribute(awa,toState);
}
Program: 97471
Project: 97471
Buggy source:
public boolean isEmpty(){
  return clipboard.getContents(ArtifactTransfer.getInstance()) == null;
}

Fixed version (ground truth):
public boolean isEmpty(){
  boolean theReturn=true;
  if (clipboard.isDisposed()) {
    theReturn=true;
  }
 else {
    theReturn=clipboard.getContents(ArtifactTransfer.getInstance()) == null;
  }
  return theReturn;
}
Program: 97472
Project: 97472
Buggy source:
private void performCopy(){
  if (clipboard == null) {
    this.clipboard=new Clipboard(null);
  }
  String detailsStr=new CopyActionDetails(awa).getDetailsString();
  clipboard.setContents(new Object[]{detailsStr},new Transfer[]{TextTransfer.getInstance()});
}

Fixed version (ground truth):
private void performCopy(){
  Clipboard clipboard=new Clipboard(null);
  try {
    String detailsStr=new CopyActionDetails(awa).getDetailsString();
    clipboard.setContents(new Object[]{detailsStr},new Transfer[]{TextTransfer.getInstance()});
  }
  finally {
    clipboard.dispose();
  }
}
Program: 97473
Project: 97473
Buggy source:
@Override public void dispose(){
  OseeEventManager.removeListener(this);
  ArtifactExplorerEventManager.remove(this);
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  OseeEventManager.removeListener(this);
  ArtifactExplorerEventManager.remove(this);
  artifactClipboard.dispose();
  super.dispose();
}
Program: 97475
Project: 97475
Buggy source:
@After public void tearDown() throws Exception {
  if (artifactWithSpecialAttr != null) {
    artifactWithSpecialAttr.deleteAndPersist();
  }
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  if (artifactWithSpecialAttr != null) {
    artifactWithSpecialAttr.deleteAndPersist();
  }
  for (  Artifact art : ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.GeneralData,ArtifactTest.class.getSimpleName(),BranchManager.getCommonBranch())) {
    art.deleteAndPersist();
  }
}
Program: 97476
Project: 97476
Buggy source:
@Override public int hashCode(){
  int hashCode=11;
  hashCode=hashCode * 37 + getGuid().hashCode();
  hashCode=hashCode * 37 + getBranchGuid().hashCode();
  return hashCode;
}

Fixed version (ground truth):
@Override public int hashCode(){
  return super.hashCode();
}
Program: 97477
Project: 97477
Buggy source:
@Override public boolean equals(Object obj){
  boolean equals=super.equals(obj);
  if (!equals && obj instanceof IBasicGuidArtifact) {
    IBasicGuidArtifact other=(IBasicGuidArtifact)obj;
    if (artTypeGuid == null || other.getArtTypeGuid() == null) {
      equals=false;
    }
    equals=artTypeGuid.equals(other.getArtTypeGuid());
    if (equals && branchGuid == null || other.getBranchGuid() == null) {
      equals=false;
    }
 else     if (equals) {
      equals=branchGuid.equals(other.getBranchGuid());
    }
    if (equals && artGuid == null || other.getGuid() == null) {
      equals=false;
    }
 else     if (equals) {
      equals=artGuid.equals(other.getGuid());
    }
  }
  return equals;
}

Fixed version (ground truth):
/** 
 * Note: DefaultBasicGuidArtifact class does not implement the hashCode, but instead uses the one implemented by Identity. It can not use the branch guid due to the need for IArtifactTokens to match Artifact instances. In addition, the event system requires that the DefaultBasicGuidArtifact and Artifact hashcode matches.
 */
@Override public boolean equals(Object obj){
  boolean equals=super.equals(obj);
  if (!equals && obj instanceof IBasicGuidArtifact) {
    IBasicGuidArtifact other=(IBasicGuidArtifact)obj;
    if (artTypeGuid == null || other.getArtTypeGuid() == null) {
      equals=false;
    }
    equals=artTypeGuid.equals(other.getArtTypeGuid());
    if (equals && branchGuid == null || other.getBranchGuid() == null) {
      equals=false;
    }
 else     if (equals) {
      equals=branchGuid.equals(other.getBranchGuid());
    }
    if (equals && artGuid == null || other.getGuid() == null) {
      equals=false;
    }
 else     if (equals) {
      equals=artGuid.equals(other.getGuid());
    }
  }
  return equals;
}
Program: 97478
Project: 97478
Buggy source:
/** 
 * @param obj the reference object with which to compare.
 * @return <code>true</code> if this artifact has the same GUID and branch <code>false</code> otherwise.
 */
@Override public final boolean equals(Object obj){
  if (obj instanceof IBasicGuidArtifact) {
    IBasicGuidArtifact other=(IBasicGuidArtifact)obj;
    boolean result=getGuid().equals(other.getGuid());
    if (result) {
      if (getBranchGuid() != null && other.getBranchGuid() != null) {
        result=getBranchGuid().equals(other.getBranchGuid());
      }
    }
    return result;
  }
  if (obj instanceof IArtifact) {
    IArtifact other=(IArtifact)obj;
    boolean result=getGuid().equals(other.getGuid());
    if (result) {
      if (getBranch() != null && other.getBranch() != null) {
        result=getBranch().equals(other.getBranch());
      }
 else {
        result=getBranch() == null && other.getBranch() == null;
      }
    }
    return result;
  }
  if (obj instanceof IArtifactToken) {
    IArtifactToken token=(IArtifactToken)obj;
    return getGuid().equals(token.getGuid());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Note: Artifact class does not implement the hashCode, but instead uses the one implemented by Identity. It can not use the branch guid due to the need for IArtifactTokens to match Artifact instances. In addition, the event system requires that the DefaultBasicGuidArtifact and Artifact hashcode matches.
 * @param obj the reference object with which to compare.
 * @return <code>true</code> if this artifact has the same GUID and branch <code>false</code> otherwise.
 */
@Override public final boolean equals(Object obj){
  if (obj instanceof IBasicGuidArtifact) {
    IBasicGuidArtifact other=(IBasicGuidArtifact)obj;
    boolean result=getGuid().equals(other.getGuid());
    if (result) {
      if (getBranchGuid() != null && other.getBranchGuid() != null) {
        result=getBranchGuid().equals(other.getBranchGuid());
      }
    }
    return result;
  }
  if (obj instanceof IArtifact) {
    IArtifact other=(IArtifact)obj;
    boolean result=getGuid().equals(other.getGuid());
    if (result) {
      if (getBranch() != null && other.getBranch() != null) {
        result=getBranch().equals(other.getBranch());
      }
 else {
        result=getBranch() == null && other.getBranch() == null;
      }
    }
    return result;
  }
  if (obj instanceof IArtifactToken) {
    IArtifactToken token=(IArtifactToken)obj;
    return getGuid().equals(token.getGuid());
  }
  return false;
}
Program: 97479
Project: 97479
Buggy source:
@Override public Collection<Integer> getAllQueryIds(OseeConnection connection,JoinItem joinItem) throws OseeCoreException {
  Collection<Integer> queryIds=new ArrayList<Integer>();
  IOseeStatement chStmt=databaseService.getStatement();
  try {
    String query=String.format(SELECT_QUERY_IDS,joinItem.getJoinTableName());
    chStmt.runPreparedQuery(query);
    while (chStmt.next()) {
      queryIds.add(chStmt.getInt("String_Node_Str"));
    }
  }
  finally {
    chStmt.close();
  }
  return queryIds;
}

Fixed version (ground truth):
@Override public Collection<Integer> getAllQueryIds(OseeConnection connection,JoinItem joinItem) throws OseeCoreException {
  Collection<Integer> queryIds=new ArrayList<Integer>();
  IOseeStatement chStmt=databaseService.getStatement(connection);
  try {
    String query=String.format(SELECT_QUERY_IDS,joinItem.getJoinTableName());
    chStmt.runPreparedQuery(query);
    while (chStmt.next()) {
      queryIds.add(chStmt.getInt("String_Node_Str"));
    }
  }
  finally {
    chStmt.close();
  }
  return queryIds;
}
Program: 97480
Project: 97480
Buggy source:
@Override protected void handleTxFinally() throws OseeCoreException {
  if (success) {
    if (mergeBranch != null) {
      getDatabaseService().runPreparedUpdate(connection,UPDATE_CONFLICT_STATUS,ConflictStatus.COMMITTED.getValue(),ConflictStatus.RESOLVED.getValue(),mergeBranch.getId());
    }
  }
}

Fixed version (ground truth):
@Override protected void handleTxFinally() throws OseeCoreException {
  if (success) {
    if (mergeBranch != null) {
      getDatabaseService().runPreparedUpdate(UPDATE_CONFLICT_STATUS,ConflictStatus.COMMITTED.getValue(),ConflictStatus.RESOLVED.getValue(),mergeBranch.getId());
    }
  }
}
Program: 97481
Project: 97481
Buggy source:
private void loadByItemId(Collection<ChangeItem> changeData,int txJoinId,ChangeItemFactory factory) throws OseeCoreException {
  HashMap<Integer,ChangeItem> changesByItemId=new HashMap<Integer,ChangeItem>();
  IdJoinQuery idJoin=JoinUtility.createIdJoinQuery();
  changeItemLoader.loadItemIdsBasedOnGammas(factory,txJoinId,changesByItemId,idJoin);
  idJoin.store();
  if (hasMergeBranch()) {
    loadCurrentData(factory.getItemTableName(),factory.getItemIdColumnName(),idJoin,changesByItemId,mergeTransaction);
  }
  loadCurrentData(factory.getItemTableName(),factory.getItemIdColumnName(),idJoin,changesByItemId,getCompareBranchHeadTx());
  loadNonCurrentSourceData(factory.getItemTableName(),factory.getItemIdColumnName(),idJoin,changesByItemId,factory.getItemValueColumnName());
  idJoin.delete();
  changeData.addAll(changesByItemId.values());
}

Fixed version (ground truth):
private void loadByItemId(Collection<ChangeItem> changeData,int txJoinId,ChangeItemFactory factory) throws OseeCoreException {
  HashMap<Integer,ChangeItem> changesByItemId=new HashMap<Integer,ChangeItem>();
  IdJoinQuery idJoin=JoinUtility.createIdJoinQuery();
  try {
    changeItemLoader.loadItemIdsBasedOnGammas(factory,txJoinId,changesByItemId,idJoin);
    idJoin.store();
    if (hasMergeBranch()) {
      loadCurrentData(factory.getItemTableName(),factory.getItemIdColumnName(),idJoin,changesByItemId,mergeTransaction);
    }
    loadCurrentData(factory.getItemTableName(),factory.getItemIdColumnName(),idJoin,changesByItemId,getCompareBranchHeadTx());
    loadNonCurrentSourceData(factory.getItemTableName(),factory.getItemIdColumnName(),idJoin,changesByItemId,factory.getItemValueColumnName());
    changeData.addAll(changesByItemId.values());
  }
  finally {
    idJoin.delete();
  }
}
Program: 97482
Project: 97482
Buggy source:
@BeforeClass @AfterClass public static void cleanup() throws OseeCoreException {
  SkynetTransaction transaction=TransactionManager.createTransaction(AtsUtilCore.getAtsBranchToken(),VersionArtifactStoreTest.class.getSimpleName() + "String_Node_Str");
  for (  String name : Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")) {
    for (    Artifact art : ArtifactQuery.getArtifactListFromTypeAndName(AtsArtifactTypes.Version,name,AtsUtilCore.getAtsBranchToken())) {
      art.deleteAndPersist(transaction);
    }
  }
  transaction.execute();
}

Fixed version (ground truth):
@BeforeClass @AfterClass public static void cleanup() throws OseeCoreException {
  SkynetTransaction transaction=TransactionManager.createTransaction(AtsUtilCore.getAtsBranchToken(),VersionArtifactStoreTest.class.getSimpleName() + "String_Node_Str");
  AtsConfigCache instance=AtsConfigCache.instance;
  for (  String name : Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")) {
    for (    Artifact art : ArtifactQuery.getArtifactListFromTypeAndName(AtsArtifactTypes.Version,name,AtsUtilCore.getAtsBranchToken())) {
      art.deleteAndPersist(transaction);
      IAtsConfigObject soleByGuid=instance.getSoleByGuid(art.getGuid());
      instance.decache(soleByGuid);
    }
  }
  transaction.execute();
}