nus-yam/ex-repair huggingface dataset:
Program: 91536
Project: 91536
Buggy source:
@Test public void testCloneRepoButton() throws Exception {
  clearView();
  refreshAndWait();
  assertEmpty();
  getOrOpenView().toolbarButton(myUtil.getPluginLocalizedValue("String_Node_Str")).click();
  SWTBotShell shell=bot.shell(UIText.GitCloneWizard_title).activate();
  shell.bot().textInGroup(UIText.RepositorySelectionPage_groupLocation,0).setText(repositoryFile.getPath());
  shell.bot().button(IDialogConstants.NEXT_LABEL).click();
  waitInUI();
  shell.bot().button(IDialogConstants.NEXT_LABEL).click();
  waitInUI();
  SWTBotText pathText=shell.bot().text(0);
  pathText.setText(pathText.getText() + "String_Node_Str");
  shell.bot().button(IDialogConstants.FINISH_LABEL).click();
  waitInUI();
  refreshAndWait();
  assertHasClonedRepo();
}

Fixed version (ground truth):
@Test public void testCloneRepoButton() throws Exception {
  clearView();
  refreshAndWait();
  assertEmpty();
  getOrOpenView().toolbarButton(myUtil.getPluginLocalizedValue("String_Node_Str")).click();
  SWTBotShell shell=bot.shell(UIText.GitCloneWizard_title).activate();
  shell.bot().textInGroup(UIText.RepositorySelectionPage_groupLocation,0).setText(repositoryFile.getPath());
  shell.bot().button(IDialogConstants.NEXT_LABEL).click();
  waitInUI();
  shell.bot().button(IDialogConstants.NEXT_LABEL).click();
  waitInUI();
  SWTBotText pathText=shell.bot().text(0);
  pathText.setText(pathText.getText() + "String_Node_Str");
  shell.bot().button(IDialogConstants.FINISH_LABEL).click();
  refreshAndWait();
  assertHasClonedRepo();
}
Program: 91537
Project: 91537
Buggy source:
private void assertHasClonedRepo() throws Exception {
  final SWTBotTree tree=getOrOpenView().bot().tree();
  final SWTBotTreeItem[] items=tree.getAllItems();
  boolean found=false;
  for (  SWTBotTreeItem item : items) {
    if (item.getText().startsWith(repositoryFile.getParentFile().getName() + "String_Node_Str")) {
      found=true;
      break;
    }
  }
  assertTrue("String_Node_Str",found);
}

Fixed version (ground truth):
private void assertHasClonedRepo() throws Exception {
  final SWTBotTree tree=getOrOpenView().bot().tree();
  String text=repositoryFile.getParentFile().getName() + "String_Node_Str";
  TestUtil.waitUntilTreeHasNodeWithText(bot,tree,text,10000);
}
Program: 91538
Project: 91538
Buggy source:
@Test public void testDeleteSingleBranch() throws Exception {
  SWTBotTree tree=getOrOpenView().bot().tree();
  refreshAndWait();
  SWTBotTreeItem localBranchesItem=myRepoViewUtil.getLocalBranchesItem(tree,repositoryFile).expand();
  SWTBotTreeItem masterNode=localBranchesItem.getNode("String_Node_Str");
  masterNode.select();
  ContextMenuHelper.clickContextMenu(tree,myUtil.getPluginLocalizedValue("String_Node_Str"));
  TestUtil.joinJobs(JobFamilies.CHECKOUT);
  ContextMenuHelper.clickContextMenu(tree,myUtil.getPluginLocalizedValue("String_Node_Str"));
  SWTBotShell createBranchShell=bot.shell(UIText.CreateBranchWizard_NewBranchTitle);
  createBranchShell.bot().textWithId("String_Node_Str").setText("String_Node_Str");
  createBranchShell.bot().checkBox().deselect();
  createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
  refreshAndWait();
  localBranchesItem.getNode("String_Node_Str").select();
  ContextMenuHelper.clickContextMenu(tree,myUtil.getPluginLocalizedValue("String_Node_Str"));
  refreshAndWait();
  SWTBotTreeItem[] items=myRepoViewUtil.getLocalBranchesItem(tree,repositoryFile).getItems();
  assertEquals("String_Node_Str",2,items.length);
  assertEquals("String_Node_Str",items[0].getText());
  assertEquals("String_Node_Str",items[1].getText());
}

Fixed version (ground truth):
@Test public void testDeleteSingleBranch() throws Exception {
  SWTBotTree tree=getOrOpenView().bot().tree();
  refreshAndWait();
  SWTBotTreeItem localBranchesItem=myRepoViewUtil.getLocalBranchesItem(tree,repositoryFile).expand();
  SWTBotTreeItem masterNode=localBranchesItem.getNode("String_Node_Str");
  masterNode.select();
  ContextMenuHelper.clickContextMenu(tree,myUtil.getPluginLocalizedValue("String_Node_Str"));
  TestUtil.joinJobs(JobFamilies.CHECKOUT);
  ContextMenuHelper.clickContextMenu(tree,myUtil.getPluginLocalizedValue("String_Node_Str"));
  SWTBotShell createBranchShell=bot.shell(UIText.CreateBranchWizard_NewBranchTitle);
  createBranchShell.bot().textWithId("String_Node_Str").setText("String_Node_Str");
  createBranchShell.bot().checkBox().deselect();
  createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
  refreshAndWait();
  localBranchesItem=myRepoViewUtil.getLocalBranchesItem(tree,repositoryFile).expand();
  localBranchesItem.getNode("String_Node_Str").select();
  ContextMenuHelper.clickContextMenu(tree,myUtil.getPluginLocalizedValue("String_Node_Str"));
  refreshAndWait();
  SWTBotTreeItem[] items=myRepoViewUtil.getLocalBranchesItem(tree,repositoryFile).getItems();
  assertEquals("String_Node_Str",2,items.length);
  assertEquals("String_Node_Str",items[0].getText());
  assertEquals("String_Node_Str",items[1].getText());
}
Program: 91540
Project: 91540
Buggy source:
@Test public void shouldReturnListOfChanges() throws Exception {
  resetRepository(PROJ1);
  changeFilesInProject();
  showDialog(PROJ1,"String_Node_Str","String_Node_Str");
  bot.shell("String_Node_Str" + REPO1 + File.separator+ "String_Node_Str").activate();
  bot.comboBox(0).setSelection(UIText.SynchronizeWithAction_localRepoName);
  bot.comboBox(1).setSelection(HEAD);
  bot.comboBox(2).setSelection(UIText.SynchronizeWithAction_localRepoName);
  bot.comboBox(3).setSelection(MASTER);
  bot.checkBox("String_Node_Str").click();
  bot.button(IDialogConstants.OK_LABEL).click();
  bot.sleep(1000);
  SWTBotTree syncViewTree=bot.viewByTitle("String_Node_Str").bot().tree();
  assertEquals(1,syncViewTree.getAllItems().length);
  SWTBotTreeItem[] syncItems=syncViewTree.getAllItems();
  assertEquals(UIText.GitModelWorkingTree_workingTree,syncItems[0].getText());
}

Fixed version (ground truth):
@Test public void shouldReturnListOfChanges() throws Exception {
  resetRepository(PROJ1);
  changeFilesInProject();
  showDialog(PROJ1,"String_Node_Str","String_Node_Str");
  bot.shell("String_Node_Str" + REPO1 + File.separator+ "String_Node_Str").activate();
  bot.comboBox(0).setSelection(UIText.SynchronizeWithAction_localRepoName);
  bot.comboBox(1).setSelection(HEAD);
  bot.comboBox(2).setSelection(UIText.SynchronizeWithAction_localRepoName);
  bot.comboBox(3).setSelection(MASTER);
  bot.checkBox("String_Node_Str").click();
  bot.button(IDialogConstants.OK_LABEL).click();
  bot.sleep(1000);
  SWTBotTree syncViewTree=bot.viewByTitle("String_Node_Str").bot().tree();
  bot.waitUntil(Conditions.treeHasRows(syncViewTree,1),10000);
  SWTBotTreeItem[] syncItems=syncViewTree.getAllItems();
  assertEquals(UIText.GitModelWorkingTree_workingTree,syncItems[0].getText());
}
Program: 91541
Project: 91541
Buggy source:
private void saveOriginalChangeId(){
  int changeIdOffset=findOffsetOfChangeIdLine(previousCommitMessage);
  if (changeIdOffset > 0) {
    int endOfChangeId=findNextEOL(changeIdOffset,previousCommitMessage);
    int sha1Offset=changeIdOffset + "String_Node_Str".length();
    try {
      originalChangeId=ObjectId.fromString(previousCommitMessage.substring(sha1Offset,endOfChangeId));
    }
 catch (    IllegalArgumentException e) {
      originalChangeId=null;
    }
  }
 else   originalChangeId=null;
}

Fixed version (ground truth):
private void saveOriginalChangeId(){
  int changeIdOffset=findOffsetOfChangeIdLine(previousCommitMessage);
  if (changeIdOffset > 0) {
    int endOfChangeId=findNextEOL(changeIdOffset,previousCommitMessage);
    if (endOfChangeId < 0)     endOfChangeId=previousCommitMessage.length() - 1;
    int sha1Offset=changeIdOffset + "String_Node_Str".length();
    try {
      originalChangeId=ObjectId.fromString(previousCommitMessage.substring(sha1Offset,endOfChangeId));
    }
 catch (    IllegalArgumentException e) {
      originalChangeId=null;
    }
  }
 else   originalChangeId=null;
}
Program: 91545
Project: 91545
Buggy source:
public ITypedElement getRight(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,baseCommit,repo,baseId);
}

Fixed version (ground truth):
public ITypedElement getRight(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,remoteCommit,repo,baseId);
}
Program: 91546
Project: 91546
Buggy source:
public ITypedElement getLeft(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,remoteCommit,repo,remoteId);
}

Fixed version (ground truth):
public ITypedElement getLeft(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,baseCommit,repo,remoteId);
}
Program: 91547
Project: 91547
Buggy source:
private String getAbbreviatedId(GitModelCommit commit){
  RevCommit remoteCommit=commit.getRemoteCommit();
  ObjectReader reader=commit.getRepository().newObjectReader();
  ObjectId commitId=remoteCommit.getId();
  AbbreviatedObjectId shortId;
  try {
    shortId=reader.abbreviate(commitId,6);
  }
 catch (  IOException e) {
    shortId=AbbreviatedObjectId.fromObjectId(ObjectId.zeroId());
    Activator.logError(e.getMessage(),e);
  }
 finally {
    reader.release();
  }
  return shortId.name();
}

Fixed version (ground truth):
private String getAbbreviatedId(GitModelCommit commit){
  RevCommit remoteCommit=commit.getBaseCommit();
  ObjectReader reader=commit.getRepository().newObjectReader();
  ObjectId commitId=remoteCommit.getId();
  AbbreviatedObjectId shortId;
  try {
    shortId=reader.abbreviate(commitId,6);
  }
 catch (  IOException e) {
    shortId=AbbreviatedObjectId.fromObjectId(ObjectId.zeroId());
    Activator.logError(e.getMessage(),e);
  }
 finally {
    reader.release();
  }
  return shortId.name();
}
Program: 91548
Project: 91548
Buggy source:
@Override public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof GitModelWorkingTree)   return -1;
  if (e2 instanceof GitModelWorkingTree)   return 1;
  if (e1 instanceof GitModelCache)   return -2;
  if (e2 instanceof GitModelCache)   return 2;
  if (e1 instanceof GitModelCommit && e2 instanceof GitModelCommit) {
    RevCommit rc1=((GitModelCommit)e1).getRemoteCommit();
    RevCommit rc2=((GitModelCommit)e2).getRemoteCommit();
    return rc2.getCommitTime() - rc1.getCommitTime();
  }
  return super.compare(viewer,e1,e2);
}

Fixed version (ground truth):
@Override public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof GitModelWorkingTree)   return -1;
  if (e2 instanceof GitModelWorkingTree)   return 1;
  if (e1 instanceof GitModelCache)   return -2;
  if (e2 instanceof GitModelCache)   return 2;
  if (e1 instanceof GitModelCommit && e2 instanceof GitModelCommit) {
    RevCommit rc1=((GitModelCommit)e1).getBaseCommit();
    RevCommit rc2=((GitModelCommit)e2).getBaseCommit();
    return rc2.getCommitTime() - rc1.getCommitTime();
  }
  return super.compare(viewer,e1,e2);
}
Program: 91549
Project: 91549
Buggy source:
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  Repository repo=gitRepo.getRepository();
  List<ResourceTraversal> result=new ArrayList<ResourceTraversal>();
  for (  GitModelObject obj : gitRepo.getChildren())   if (obj instanceof GitModelCommit || obj instanceof GitModelCache) {
    RevCommit revCommit;
    if (obj instanceof GitModelCommit)     revCommit=((GitModelCommit)obj).getRemoteCommit();
 else     revCommit=((GitModelCache)obj).getRemoteCommit();
    result.add(new GitTreeTraversal(repo,revCommit));
  }
  return result.toArray(new ResourceTraversal[result.size()]);
}

Fixed version (ground truth):
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  Repository repo=gitRepo.getRepository();
  List<ResourceTraversal> result=new ArrayList<ResourceTraversal>();
  for (  GitModelObject obj : gitRepo.getChildren())   if (obj instanceof GitModelCommit || obj instanceof GitModelCache) {
    RevCommit revCommit;
    if (obj instanceof GitModelCommit)     revCommit=((GitModelCommit)obj).getBaseCommit();
 else     revCommit=((GitModelCache)obj).getBaseCommit();
    result.add(new GitTreeTraversal(repo,revCommit));
  }
  return result.toArray(new ResourceTraversal[result.size()]);
}
Program: 91550
Project: 91550
Buggy source:
private GitModelObject extractFromCache(TreeWalk tw) throws IOException {
  DirCacheIterator cacheIterator=tw.getTree(dirCacheIteratorNth,DirCacheIterator.class);
  if (cacheIterator == null)   return null;
  DirCacheEntry cacheEntry=cacheIterator.getDirCacheEntry();
  if (cacheEntry == null)   return null;
  if (shouldIncludeEntry(tw)) {
    String path=new String(tw.getRawPath());
    ObjectId repoId=tw.getObjectId(BASE_NTH);
    ObjectId cacheId=tw.getObjectId(REMOTE_NTH);
    if (path.split("String_Node_Str").length > 1)     return handleCacheTree(repoId,cacheId,path);
    return fileFactory.createFileModel(this,remoteCommit,repoId,cacheId,path);
  }
  return null;
}

Fixed version (ground truth):
private GitModelObject extractFromCache(TreeWalk tw) throws IOException {
  DirCacheIterator cacheIterator=tw.getTree(dirCacheIteratorNth,DirCacheIterator.class);
  if (cacheIterator == null)   return null;
  DirCacheEntry cacheEntry=cacheIterator.getDirCacheEntry();
  if (cacheEntry == null)   return null;
  if (shouldIncludeEntry(tw)) {
    String path=new String(tw.getRawPath());
    ObjectId repoId=tw.getObjectId(BASE_NTH);
    ObjectId cacheId=tw.getObjectId(REMOTE_NTH);
    if (path.split("String_Node_Str").length > 1)     return handleCacheTree(repoId,cacheId,path);
    return fileFactory.createFileModel(this,baseCommit,repoId,cacheId,path);
  }
  return null;
}
Program: 91551
Project: 91551
Buggy source:
private GitModelObject handleCacheTree(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String pathKey=path.split("String_Node_Str")[0];
  GitModelCacheTree cacheTree=cacheTreeMap.get(pathKey);
  if (cacheTree == null) {
    cacheTree=new GitModelCacheTree(this,remoteCommit,repoId,cacheId,pathKey,fileFactory);
    cacheTreeMap.put(pathKey,cacheTree);
  }
  cacheTree.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  return cacheTree;
}

Fixed version (ground truth):
private GitModelObject handleCacheTree(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String pathKey=path.split("String_Node_Str")[0];
  GitModelCacheTree cacheTree=cacheTreeMap.get(pathKey);
  if (cacheTree == null) {
    cacheTree=new GitModelCacheTree(this,baseCommit,repoId,cacheId,pathKey,fileFactory);
    cacheTreeMap.put(pathKey,cacheTree);
  }
  cacheTree.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  return cacheTree;
}
Program: 91552
Project: 91552
Buggy source:
void addChild(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String[] entrys=path.split("String_Node_Str");
  String pathKey=entrys[0];
  if (entrys.length > 1) {
    GitModelCacheTree cacheEntry=(GitModelCacheTree)cacheTreeMap.get(pathKey);
    if (cacheEntry == null) {
      cacheEntry=new GitModelCacheTree(this,remoteCommit,repoId,cacheId,pathKey,factory);
      cacheTreeMap.put(pathKey,cacheEntry);
    }
    cacheEntry.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  }
 else   cacheTreeMap.put(pathKey,factory.createFileModel(this,remoteCommit,repoId,cacheId,pathKey));
}

Fixed version (ground truth):
void addChild(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String[] entrys=path.split("String_Node_Str");
  String pathKey=entrys[0];
  if (entrys.length > 1) {
    GitModelCacheTree cacheEntry=(GitModelCacheTree)cacheTreeMap.get(pathKey);
    if (cacheEntry == null) {
      cacheEntry=new GitModelCacheTree(this,baseCommit,repoId,cacheId,pathKey,factory);
      cacheTreeMap.put(pathKey,cacheEntry);
    }
    cacheEntry.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  }
 else   cacheTreeMap.put(pathKey,factory.createFileModel(this,baseCommit,repoId,cacheId,pathKey));
}
Program: 91553
Project: 91553
Buggy source:
@Override public int hashCode(){
  int result=getLocation().hashCode() ^ remoteCommit.hashCode();
  if (baseCommit != null)   result^=baseCommit.hashCode();
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=getLocation().hashCode() ^ baseCommit.hashCode();
  if (remoteCommit != null)   result^=remoteCommit.hashCode();
  return result;
}
Program: 91554
Project: 91554
Buggy source:
@Override protected GitModelObject[] getChildrenImpl(){
  TreeWalk tw=createTreeWalk();
  List<GitModelObject> result=new ArrayList<GitModelObject>();
  try {
    RevTree actualTree=remoteCommit.getTree();
    int actualNth=tw.addTree(actualTree);
    int baseNth=-1;
    if (baseCommit != null)     baseNth=tw.addTree(baseCommit.getTree());
    int ancestorNth=tw.addTree(ancestorCommit.getTree());
    while (tw.next()) {
      GitModelObject obj=getModelObject(tw,ancestorNth,baseNth,actualNth);
      if (obj != null)       result.add(obj);
    }
  }
 catch (  IOException e) {
    Activator.logError(e.getMessage(),e);
  }
  return result.toArray(new GitModelObject[result.size()]);
}

Fixed version (ground truth):
@Override protected GitModelObject[] getChildrenImpl(){
  TreeWalk tw=createTreeWalk();
  List<GitModelObject> result=new ArrayList<GitModelObject>();
  try {
    RevTree actualTree=baseCommit.getTree();
    int actualNth=tw.addTree(actualTree);
    int baseNth=-1;
    if (remoteCommit != null)     baseNth=tw.addTree(remoteCommit.getTree());
    int ancestorNth=tw.addTree(ancestorCommit.getTree());
    while (tw.next()) {
      GitModelObject obj=getModelObject(tw,ancestorNth,baseNth,actualNth);
      if (obj != null)       result.add(obj);
    }
  }
 catch (  IOException e) {
    Activator.logError(e.getMessage(),e);
  }
  return result.toArray(new GitModelObject[result.size()]);
}
Program: 91555
Project: 91555
Buggy source:
@Override public String getName(){
  if (name == null)   name=remoteCommit.getShortMessage();
  return name;
}

Fixed version (ground truth):
@Override public String getName(){
  if (name == null)   name=baseCommit.getShortMessage();
  return name;
}
Program: 91556
Project: 91556
Buggy source:
/** 
 * @param parent instance of parent object
 * @param commit commit connected with this container
 * @param direction indicate change direction
 * @throws IOException
 */
protected GitModelObjectContainer(GitModelObject parent,RevCommit commit,int direction) throws IOException {
  super(parent);
  kind=direction;
  remoteCommit=commit;
  ancestorCommit=calculateAncestor(remoteCommit);
  RevCommit[] parents=remoteCommit.getParents();
  if (parents != null && parents.length > 0)   baseCommit=remoteCommit.getParent(0);
 else {
    baseCommit=null;
  }
}

Fixed version (ground truth):
/** 
 * @param parent instance of parent object
 * @param commit commit connected with this container
 * @param direction indicate change direction
 * @throws IOException
 */
protected GitModelObjectContainer(GitModelObject parent,RevCommit commit,int direction) throws IOException {
  super(parent);
  kind=direction;
  baseCommit=commit;
  ancestorCommit=calculateAncestor(baseCommit);
  RevCommit[] parents=baseCommit.getParents();
  if (parents != null && parents.length > 0)   remoteCommit=baseCommit.getParent(0);
 else {
    remoteCommit=null;
  }
}
Program: 91557
Project: 91557
Buggy source:
private void calculateKind(){
  ObjectId base=baseCommit != null ? baseCommit.getId() : zeroId();
  if (base.equals(zeroId()))   kind=kind | ADDITION;
 else   if (remoteCommit.equals(zeroId()))   kind=kind | DELETION;
 else   kind=kind | CHANGE;
}

Fixed version (ground truth):
private void calculateKind(){
  ObjectId remote=remoteCommit != null ? remoteCommit.getId() : zeroId();
  if (remote.equals(zeroId()))   kind=kind | ADDITION;
 else   if (baseCommit.equals(zeroId()))   kind=kind | DELETION;
 else   kind=kind | CHANGE;
}
Program: 91558
Project: 91558
Buggy source:
/** 
 * @param tw instance of {@link TreeWalk} that should be used
 * @param ancestorNth
 * @param baseNth
 * @param actualNth
 * @return {@link GitModelObject} instance of given parameters
 * @throws IOException
 */
protected GitModelObject getModelObject(TreeWalk tw,int ancestorNth,int baseNth,int actualNth) throws IOException {
  String objName=tw.getNameString();
  ObjectId objBaseId;
  if (baseNth > -1)   objBaseId=tw.getObjectId(baseNth);
 else   objBaseId=ObjectId.zeroId();
  ObjectId objRemoteId=tw.getObjectId(actualNth);
  ObjectId objAncestorId=tw.getObjectId(ancestorNth);
  int objectType=tw.getFileMode(actualNth).getObjectType();
  if (objectType == Constants.OBJ_BLOB)   return new GitModelBlob(this,getRemoteCommit(),objAncestorId,objBaseId,objRemoteId,objName);
 else   if (objectType == Constants.OBJ_TREE)   return new GitModelTree(this,getRemoteCommit(),objAncestorId,objBaseId,objRemoteId,objName);
  return null;
}

Fixed version (ground truth):
/** 
 * @param tw instance of {@link TreeWalk} that should be used
 * @param ancestorNth
 * @param baseNth
 * @param actualNth
 * @return {@link GitModelObject} instance of given parameters
 * @throws IOException
 */
protected GitModelObject getModelObject(TreeWalk tw,int ancestorNth,int baseNth,int actualNth) throws IOException {
  String objName=tw.getNameString();
  ObjectId objBaseId;
  if (baseNth > -1)   objBaseId=tw.getObjectId(baseNth);
 else   objBaseId=ObjectId.zeroId();
  ObjectId objRemoteId=tw.getObjectId(actualNth);
  ObjectId objAncestorId=tw.getObjectId(ancestorNth);
  int objectType=tw.getFileMode(actualNth).getObjectType();
  if (objectType == Constants.OBJ_BLOB)   return new GitModelBlob(this,getBaseCommit(),objAncestorId,objBaseId,objRemoteId,objName);
 else   if (objectType == Constants.OBJ_TREE)   return new GitModelTree(this,getBaseCommit(),objAncestorId,objBaseId,objRemoteId,objName);
  return null;
}
Program: 91559
Project: 91559
Buggy source:
/** 
 * Check internal state for page completion status.
 */
private void checkPage(){
  final String dstpath=directoryText.getText();
  if (dstpath.length() == 0) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_fieldRequired,UIText.CloneDestinationPage_promptDirectory));
    setPageComplete(false);
    return;
  }
  final File absoluteFile=new File(dstpath).getAbsoluteFile();
  if (!isEmptyDir(absoluteFile)) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_errorNotEmptyDir,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!canCreateSubdir(absoluteFile.getParentFile())) {
    setErrorMessage(NLS.bind(UIText.GitCloneWizard_errorCannotCreate,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!availableRefs.isEmpty() && initialBranch.getSelectionIndex() < 0) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_fieldRequired,UIText.CloneDestinationPage_promptInitialBranch));
    setPageComplete(false);
    return;
  }
  if (remoteText.getText().length() == 0) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_fieldRequired,UIText.CloneDestinationPage_promptRemoteName));
    setPageComplete(false);
    return;
  }
  setErrorMessage(null);
  setPageComplete(true);
}

Fixed version (ground truth):
/** 
 * Check internal state for page completion status.
 */
private void checkPage(){
  final String dstpath=directoryText.getText();
  if (dstpath.length() == 0) {
    setErrorMessage(UIText.CloneDestinationPage_errorDirectoryRequired);
    setPageComplete(false);
    return;
  }
  final File absoluteFile=new File(dstpath).getAbsoluteFile();
  if (!isEmptyDir(absoluteFile)) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_errorNotEmptyDir,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!canCreateSubdir(absoluteFile.getParentFile())) {
    setErrorMessage(NLS.bind(UIText.GitCloneWizard_errorCannotCreate,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!availableRefs.isEmpty() && initialBranch.getSelectionIndex() < 0) {
    setErrorMessage(UIText.CloneDestinationPage_errorInitialBranchRequired);
    setPageComplete(false);
    return;
  }
  if (remoteText.getText().length() == 0) {
    setErrorMessage(UIText.CloneDestinationPage_errorRemoteNameRequired);
    setPageComplete(false);
    return;
  }
  setErrorMessage(null);
  setPageComplete(true);
}
Program: 91560
Project: 91560
Buggy source:
public final void selectionChanged(IAction action,ISelection selection){
  mySelection=selection;
  handler.setSelection(mySelection);
  action.setEnabled(isEnabled());
}

Fixed version (ground truth):
public final void selectionChanged(IAction action,ISelection selection){
  mySelection=selection;
  handler.setSelection(mySelection);
  if (action != null)   action.setEnabled(isEnabled());
}
Program: 91561
Project: 91561
Buggy source:
public final void selectionChanged(IAction action,ISelection selection){
  mySelection=selection;
  handler.setSelection(mySelection);
  action.setEnabled(isEnabled());
}

Fixed version (ground truth):
public final void selectionChanged(IAction action,ISelection selection){
  mySelection=selection;
  handler.setSelection(mySelection);
  if (action != null)   action.setEnabled(isEnabled());
}
Program: 91562
Project: 91562
Buggy source:
/** 
 * Check internal state for page completion status.
 */
private void checkPage(){
  final String dstpath=directoryText.getText();
  if (dstpath.length() == 0) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_fieldRequired,UIText.CloneDestinationPage_promptDirectory));
    setPageComplete(false);
    return;
  }
  final File absoluteFile=new File(dstpath).getAbsoluteFile();
  if (!isEmptyDir(absoluteFile)) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_errorNotEmptyDir,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!canCreateSubdir(absoluteFile.getParentFile())) {
    setErrorMessage(NLS.bind(UIText.GitCloneWizard_errorCannotCreate,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!availableRefs.isEmpty() && initialBranch.getSelectionIndex() < 0) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_fieldRequired,UIText.CloneDestinationPage_promptInitialBranch));
    setPageComplete(false);
    return;
  }
  if (remoteText.getText().length() == 0) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_fieldRequired,UIText.CloneDestinationPage_promptRemoteName));
    setPageComplete(false);
    return;
  }
  setErrorMessage(null);
  setPageComplete(true);
}

Fixed version (ground truth):
/** 
 * Check internal state for page completion status.
 */
private void checkPage(){
  final String dstpath=directoryText.getText();
  if (dstpath.length() == 0) {
    setErrorMessage(UIText.CloneDestinationPage_errorDirectoryRequired);
    setPageComplete(false);
    return;
  }
  final File absoluteFile=new File(dstpath).getAbsoluteFile();
  if (!isEmptyDir(absoluteFile)) {
    setErrorMessage(NLS.bind(UIText.CloneDestinationPage_errorNotEmptyDir,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!canCreateSubdir(absoluteFile.getParentFile())) {
    setErrorMessage(NLS.bind(UIText.GitCloneWizard_errorCannotCreate,absoluteFile.getPath()));
    setPageComplete(false);
    return;
  }
  if (!availableRefs.isEmpty() && initialBranch.getSelectionIndex() < 0) {
    setErrorMessage(UIText.CloneDestinationPage_errorInitialBranchRequired);
    setPageComplete(false);
    return;
  }
  if (remoteText.getText().length() == 0) {
    setErrorMessage(UIText.CloneDestinationPage_errorRemoteNameRequired);
    setPageComplete(false);
    return;
  }
  setErrorMessage(null);
  setPageComplete(true);
}
Program: 91565
Project: 91565
Buggy source:
public ITypedElement getRight(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,baseCommit,repo,baseId);
}

Fixed version (ground truth):
public ITypedElement getRight(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,remoteCommit,repo,baseId);
}
Program: 91566
Project: 91566
Buggy source:
public ITypedElement getLeft(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,remoteCommit,repo,remoteId);
}

Fixed version (ground truth):
public ITypedElement getLeft(){
  return CompareUtils.getFileRevisionTypedElement(gitPath,baseCommit,repo,remoteId);
}
Program: 91567
Project: 91567
Buggy source:
private String getAbbreviatedId(GitModelCommit commit){
  RevCommit remoteCommit=commit.getRemoteCommit();
  ObjectReader reader=commit.getRepository().newObjectReader();
  ObjectId commitId=remoteCommit.getId();
  AbbreviatedObjectId shortId;
  try {
    shortId=reader.abbreviate(commitId,6);
  }
 catch (  IOException e) {
    shortId=AbbreviatedObjectId.fromObjectId(ObjectId.zeroId());
    Activator.logError(e.getMessage(),e);
  }
 finally {
    reader.release();
  }
  return shortId.name();
}

Fixed version (ground truth):
private String getAbbreviatedId(GitModelCommit commit){
  RevCommit remoteCommit=commit.getBaseCommit();
  ObjectReader reader=commit.getRepository().newObjectReader();
  ObjectId commitId=remoteCommit.getId();
  AbbreviatedObjectId shortId;
  try {
    shortId=reader.abbreviate(commitId,6);
  }
 catch (  IOException e) {
    shortId=AbbreviatedObjectId.fromObjectId(ObjectId.zeroId());
    Activator.logError(e.getMessage(),e);
  }
 finally {
    reader.release();
  }
  return shortId.name();
}
Program: 91568
Project: 91568
Buggy source:
@Override public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof GitModelWorkingTree)   return -1;
  if (e2 instanceof GitModelWorkingTree)   return 1;
  if (e1 instanceof GitModelCache)   return -2;
  if (e2 instanceof GitModelCache)   return 2;
  if (e1 instanceof GitModelCommit && e2 instanceof GitModelCommit) {
    RevCommit rc1=((GitModelCommit)e1).getRemoteCommit();
    RevCommit rc2=((GitModelCommit)e2).getRemoteCommit();
    return rc2.getCommitTime() - rc1.getCommitTime();
  }
  return super.compare(viewer,e1,e2);
}

Fixed version (ground truth):
@Override public int compare(Viewer viewer,Object e1,Object e2){
  if (e1 instanceof GitModelWorkingTree)   return -1;
  if (e2 instanceof GitModelWorkingTree)   return 1;
  if (e1 instanceof GitModelCache)   return -2;
  if (e2 instanceof GitModelCache)   return 2;
  if (e1 instanceof GitModelCommit && e2 instanceof GitModelCommit) {
    RevCommit rc1=((GitModelCommit)e1).getBaseCommit();
    RevCommit rc2=((GitModelCommit)e2).getBaseCommit();
    return rc2.getCommitTime() - rc1.getCommitTime();
  }
  return super.compare(viewer,e1,e2);
}
Program: 91569
Project: 91569
Buggy source:
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  Repository repo=gitRepo.getRepository();
  List<ResourceTraversal> result=new ArrayList<ResourceTraversal>();
  for (  GitModelObject obj : gitRepo.getChildren())   if (obj instanceof GitModelCommit || obj instanceof GitModelCache) {
    RevCommit revCommit;
    if (obj instanceof GitModelCommit)     revCommit=((GitModelCommit)obj).getRemoteCommit();
 else     revCommit=((GitModelCache)obj).getRemoteCommit();
    result.add(new GitTreeTraversal(repo,revCommit));
  }
  return result.toArray(new ResourceTraversal[result.size()]);
}

Fixed version (ground truth):
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  Repository repo=gitRepo.getRepository();
  List<ResourceTraversal> result=new ArrayList<ResourceTraversal>();
  for (  GitModelObject obj : gitRepo.getChildren())   if (obj instanceof GitModelCommit || obj instanceof GitModelCache) {
    RevCommit revCommit;
    if (obj instanceof GitModelCommit)     revCommit=((GitModelCommit)obj).getBaseCommit();
 else     revCommit=((GitModelCache)obj).getBaseCommit();
    result.add(new GitTreeTraversal(repo,revCommit));
  }
  return result.toArray(new ResourceTraversal[result.size()]);
}
Program: 91570
Project: 91570
Buggy source:
private GitModelObject extractFromCache(TreeWalk tw) throws IOException {
  DirCacheIterator cacheIterator=tw.getTree(dirCacheIteratorNth,DirCacheIterator.class);
  if (cacheIterator == null)   return null;
  DirCacheEntry cacheEntry=cacheIterator.getDirCacheEntry();
  if (cacheEntry == null)   return null;
  if (shouldIncludeEntry(tw)) {
    String path=new String(tw.getRawPath());
    ObjectId repoId=tw.getObjectId(BASE_NTH);
    ObjectId cacheId=tw.getObjectId(REMOTE_NTH);
    if (path.split("String_Node_Str").length > 1)     return handleCacheTree(repoId,cacheId,path);
    return fileFactory.createFileModel(this,remoteCommit,repoId,cacheId,path);
  }
  return null;
}

Fixed version (ground truth):
private GitModelObject extractFromCache(TreeWalk tw) throws IOException {
  DirCacheIterator cacheIterator=tw.getTree(dirCacheIteratorNth,DirCacheIterator.class);
  if (cacheIterator == null)   return null;
  DirCacheEntry cacheEntry=cacheIterator.getDirCacheEntry();
  if (cacheEntry == null)   return null;
  if (shouldIncludeEntry(tw)) {
    String path=new String(tw.getRawPath());
    ObjectId repoId=tw.getObjectId(BASE_NTH);
    ObjectId cacheId=tw.getObjectId(REMOTE_NTH);
    if (path.split("String_Node_Str").length > 1)     return handleCacheTree(repoId,cacheId,path);
    return fileFactory.createFileModel(this,baseCommit,repoId,cacheId,path);
  }
  return null;
}
Program: 91571
Project: 91571
Buggy source:
private GitModelObject handleCacheTree(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String pathKey=path.split("String_Node_Str")[0];
  GitModelCacheTree cacheTree=cacheTreeMap.get(pathKey);
  if (cacheTree == null) {
    cacheTree=new GitModelCacheTree(this,remoteCommit,repoId,cacheId,pathKey,fileFactory);
    cacheTreeMap.put(pathKey,cacheTree);
  }
  cacheTree.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  return cacheTree;
}

Fixed version (ground truth):
private GitModelObject handleCacheTree(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String pathKey=path.split("String_Node_Str")[0];
  GitModelCacheTree cacheTree=cacheTreeMap.get(pathKey);
  if (cacheTree == null) {
    cacheTree=new GitModelCacheTree(this,baseCommit,repoId,cacheId,pathKey,fileFactory);
    cacheTreeMap.put(pathKey,cacheTree);
  }
  cacheTree.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  return cacheTree;
}
Program: 91572
Project: 91572
Buggy source:
void addChild(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String[] entrys=path.split("String_Node_Str");
  String pathKey=entrys[0];
  if (entrys.length > 1) {
    GitModelCacheTree cacheEntry=(GitModelCacheTree)cacheTreeMap.get(pathKey);
    if (cacheEntry == null) {
      cacheEntry=new GitModelCacheTree(this,remoteCommit,repoId,cacheId,pathKey,factory);
      cacheTreeMap.put(pathKey,cacheEntry);
    }
    cacheEntry.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  }
 else   cacheTreeMap.put(pathKey,factory.createFileModel(this,remoteCommit,repoId,cacheId,pathKey));
}

Fixed version (ground truth):
void addChild(ObjectId repoId,ObjectId cacheId,String path) throws IOException {
  String[] entrys=path.split("String_Node_Str");
  String pathKey=entrys[0];
  if (entrys.length > 1) {
    GitModelCacheTree cacheEntry=(GitModelCacheTree)cacheTreeMap.get(pathKey);
    if (cacheEntry == null) {
      cacheEntry=new GitModelCacheTree(this,baseCommit,repoId,cacheId,pathKey,factory);
      cacheTreeMap.put(pathKey,cacheEntry);
    }
    cacheEntry.addChild(repoId,cacheId,path.substring(path.indexOf('/') + 1));
  }
 else   cacheTreeMap.put(pathKey,factory.createFileModel(this,baseCommit,repoId,cacheId,pathKey));
}
Program: 91573
Project: 91573
Buggy source:
@Override public int hashCode(){
  int result=getLocation().hashCode() ^ remoteCommit.hashCode();
  if (baseCommit != null)   result^=baseCommit.hashCode();
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=getLocation().hashCode() ^ baseCommit.hashCode();
  if (remoteCommit != null)   result^=remoteCommit.hashCode();
  return result;
}
Program: 91574
Project: 91574
Buggy source:
@Override protected GitModelObject[] getChildrenImpl(){
  TreeWalk tw=createTreeWalk();
  List<GitModelObject> result=new ArrayList<GitModelObject>();
  try {
    RevTree actualTree=remoteCommit.getTree();
    int actualNth=tw.addTree(actualTree);
    int baseNth=-1;
    if (baseCommit != null)     baseNth=tw.addTree(baseCommit.getTree());
    int ancestorNth=tw.addTree(ancestorCommit.getTree());
    while (tw.next()) {
      GitModelObject obj=getModelObject(tw,ancestorNth,baseNth,actualNth);
      if (obj != null)       result.add(obj);
    }
  }
 catch (  IOException e) {
    Activator.logError(e.getMessage(),e);
  }
  return result.toArray(new GitModelObject[result.size()]);
}

Fixed version (ground truth):
@Override protected GitModelObject[] getChildrenImpl(){
  TreeWalk tw=createTreeWalk();
  List<GitModelObject> result=new ArrayList<GitModelObject>();
  try {
    RevTree actualTree=baseCommit.getTree();
    int actualNth=tw.addTree(actualTree);
    int baseNth=-1;
    if (remoteCommit != null)     baseNth=tw.addTree(remoteCommit.getTree());
    int ancestorNth=tw.addTree(ancestorCommit.getTree());
    while (tw.next()) {
      GitModelObject obj=getModelObject(tw,ancestorNth,baseNth,actualNth);
      if (obj != null)       result.add(obj);
    }
  }
 catch (  IOException e) {
    Activator.logError(e.getMessage(),e);
  }
  return result.toArray(new GitModelObject[result.size()]);
}
Program: 91575
Project: 91575
Buggy source:
@Override public String getName(){
  if (name == null)   name=remoteCommit.getShortMessage();
  return name;
}

Fixed version (ground truth):
@Override public String getName(){
  if (name == null)   name=baseCommit.getShortMessage();
  return name;
}
Program: 91576
Project: 91576
Buggy source:
/** 
 * @param parent instance of parent object
 * @param commit commit connected with this container
 * @param direction indicate change direction
 * @throws IOException
 */
protected GitModelObjectContainer(GitModelObject parent,RevCommit commit,int direction) throws IOException {
  super(parent);
  kind=direction;
  remoteCommit=commit;
  ancestorCommit=calculateAncestor(remoteCommit);
  RevCommit[] parents=remoteCommit.getParents();
  if (parents != null && parents.length > 0)   baseCommit=remoteCommit.getParent(0);
 else {
    baseCommit=null;
  }
}

Fixed version (ground truth):
/** 
 * @param parent instance of parent object
 * @param commit commit connected with this container
 * @param direction indicate change direction
 * @throws IOException
 */
protected GitModelObjectContainer(GitModelObject parent,RevCommit commit,int direction) throws IOException {
  super(parent);
  kind=direction;
  baseCommit=commit;
  ancestorCommit=calculateAncestor(baseCommit);
  RevCommit[] parents=baseCommit.getParents();
  if (parents != null && parents.length > 0)   remoteCommit=baseCommit.getParent(0);
 else {
    remoteCommit=null;
  }
}
Program: 91577
Project: 91577
Buggy source:
private void calculateKind(){
  ObjectId base=baseCommit != null ? baseCommit.getId() : zeroId();
  if (base.equals(zeroId()))   kind=kind | ADDITION;
 else   if (remoteCommit.equals(zeroId()))   kind=kind | DELETION;
 else   kind=kind | CHANGE;
}

Fixed version (ground truth):
private void calculateKind(){
  ObjectId remote=remoteCommit != null ? remoteCommit.getId() : zeroId();
  if (remote.equals(zeroId()))   kind=kind | ADDITION;
 else   if (baseCommit.equals(zeroId()))   kind=kind | DELETION;
 else   kind=kind | CHANGE;
}
Program: 91578
Project: 91578
Buggy source:
/** 
 * @param tw instance of {@link TreeWalk} that should be used
 * @param ancestorNth
 * @param baseNth
 * @param actualNth
 * @return {@link GitModelObject} instance of given parameters
 * @throws IOException
 */
protected GitModelObject getModelObject(TreeWalk tw,int ancestorNth,int baseNth,int actualNth) throws IOException {
  String objName=tw.getNameString();
  ObjectId objBaseId;
  if (baseNth > -1)   objBaseId=tw.getObjectId(baseNth);
 else   objBaseId=ObjectId.zeroId();
  ObjectId objRemoteId=tw.getObjectId(actualNth);
  ObjectId objAncestorId=tw.getObjectId(ancestorNth);
  int objectType=tw.getFileMode(actualNth).getObjectType();
  if (objectType == Constants.OBJ_BLOB)   return new GitModelBlob(this,getRemoteCommit(),objAncestorId,objBaseId,objRemoteId,objName);
 else   if (objectType == Constants.OBJ_TREE)   return new GitModelTree(this,getRemoteCommit(),objAncestorId,objBaseId,objRemoteId,objName);
  return null;
}

Fixed version (ground truth):
/** 
 * @param tw instance of {@link TreeWalk} that should be used
 * @param ancestorNth
 * @param baseNth
 * @param actualNth
 * @return {@link GitModelObject} instance of given parameters
 * @throws IOException
 */
protected GitModelObject getModelObject(TreeWalk tw,int ancestorNth,int baseNth,int actualNth) throws IOException {
  String objName=tw.getNameString();
  ObjectId objBaseId;
  if (baseNth > -1)   objBaseId=tw.getObjectId(baseNth);
 else   objBaseId=ObjectId.zeroId();
  ObjectId objRemoteId=tw.getObjectId(actualNth);
  ObjectId objAncestorId=tw.getObjectId(ancestorNth);
  int objectType=tw.getFileMode(actualNth).getObjectType();
  if (objectType == Constants.OBJ_BLOB)   return new GitModelBlob(this,getBaseCommit(),objAncestorId,objBaseId,objRemoteId,objName);
 else   if (objectType == Constants.OBJ_TREE)   return new GitModelTree(this,getBaseCommit(),objAncestorId,objBaseId,objRemoteId,objName);
  return null;
}
Program: 91579
Project: 91579
Buggy source:
/** 
 * Allows access to the localized values of the EGit UI Plug-in <p>
 * @param key see  {@link #getPluginLocalizedValue(String)}
 * @param keepAmpersands if <code>true</code>, ampersands will be kept
 * @return see {@link #getPluginLocalizedValue(String)}
 * @throws MissingResourceException see  {@link #getPluginLocalizedValue(String)}
 */
public synchronized String getPluginLocalizedValue(String key,boolean keepAmpersands) throws MissingResourceException {
  if (myBundle == null) {
    ServiceTracker localizationTracker;
    BundleContext context=Activator.getDefault().getBundle().getBundleContext();
    localizationTracker=new ServiceTracker(context,BundleLocalization.class.getName(),null);
    localizationTracker.open();
    BundleLocalization location=(BundleLocalization)localizationTracker.getService();
    if (location != null)     myBundle=location.getLocalization(Activator.getDefault().getBundle(),Locale.getDefault().toString());
  }
  String raw=myBundle.getString(key);
  if (keepAmpersands || raw.indexOf(AMPERSAND) < 0)   return raw;
  StringBuilder sb=new StringBuilder(raw.length());
  for (int i=0; i < raw.length(); i++) {
    char c=raw.charAt(i);
    if (c != AMPERSAND)     sb.append(c);
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Allows access to the localized values of the EGit UI Plug-in <p>
 * @param key see  {@link #getPluginLocalizedValue(String)}
 * @param keepAmpersands if <code>true</code>, ampersands will be kept
 * @return see {@link #getPluginLocalizedValue(String)}
 * @throws MissingResourceException see  {@link #getPluginLocalizedValue(String)}
 */
public synchronized String getPluginLocalizedValue(String key,boolean keepAmpersands) throws MissingResourceException {
  if (myBundle == null) {
    ServiceTracker localizationTracker;
    BundleContext context=Activator.getDefault().getBundle().getBundleContext();
    localizationTracker=new ServiceTracker(context,BundleLocalization.class.getName(),null);
    localizationTracker.open();
    BundleLocalization location=(BundleLocalization)localizationTracker.getService();
    if (location != null)     myBundle=location.getLocalization(Activator.getDefault().getBundle(),Locale.getDefault().toString());
  }
  if (myBundle != null) {
    String raw=myBundle.getString(key);
    if (keepAmpersands || raw.indexOf(AMPERSAND) < 0)     return raw;
    StringBuilder sb=new StringBuilder(raw.length());
    for (int i=0; i < raw.length(); i++) {
      char c=raw.charAt(i);
      if (c != AMPERSAND)       sb.append(c);
    }
    return sb.toString();
  }
  return null;
}
Program: 91582
Project: 91582
Buggy source:
/** 
 * Creates a new branch
 * @param refName starting point for the new branch
 * @param newRefName
 * @throws IOException
 */
public void createBranch(String refName,String newRefName) throws IOException {
  RefUpdate updateRef;
  updateRef=repository.updateRef(newRefName);
  Ref startRef=repository.getRef(refName);
  ObjectId startAt=repository.resolve(refName);
  String startBranch;
  if (startRef != null)   startBranch=refName;
 else   startBranch=startAt.name();
  startBranch=repository.shortenRefName(startBranch);
  updateRef.setNewObjectId(startAt);
  updateRef.setRefLogMessage("String_Node_Str" + startBranch,false);
  updateRef.update();
}

Fixed version (ground truth):
/** 
 * Creates a new branch
 * @param refName starting point for the new branch
 * @param newRefName
 * @throws IOException
 */
public void createBranch(String refName,String newRefName) throws IOException {
  RefUpdate updateRef;
  updateRef=repository.updateRef(newRefName);
  Ref startRef=repository.getRef(refName);
  ObjectId startAt=repository.resolve(refName);
  String startBranch;
  if (startRef != null)   startBranch=refName;
 else   startBranch=startAt.name();
  startBranch=Repository.shortenRefName(startBranch);
  updateRef.setNewObjectId(startAt);
  updateRef.setRefLogMessage("String_Node_Str" + startBranch,false);
  updateRef.update();
}
Program: 91583
Project: 91583
Buggy source:
protected static void createStableBranch(Repository myRepository) throws IOException {
  String newRefName="String_Node_Str";
  RefUpdate updateRef=myRepository.updateRef(newRefName);
  Ref sourceBranch=myRepository.getRef("String_Node_Str");
  ObjectId startAt=sourceBranch.getObjectId();
  String startBranch=myRepository.shortenRefName(sourceBranch.getName());
  updateRef.setNewObjectId(startAt);
  updateRef.setRefLogMessage("String_Node_Str" + startBranch,false);
  updateRef.update();
}

Fixed version (ground truth):
protected static void createStableBranch(Repository myRepository) throws IOException {
  String newRefName="String_Node_Str";
  RefUpdate updateRef=myRepository.updateRef(newRefName);
  Ref sourceBranch=myRepository.getRef("String_Node_Str");
  ObjectId startAt=sourceBranch.getObjectId();
  String startBranch=Repository.shortenRefName(sourceBranch.getName());
  updateRef.setNewObjectId(startAt);
  updateRef.setRefLogMessage("String_Node_Str" + startBranch,false);
  updateRef.update();
}
Program: 91584
Project: 91584
Buggy source:
protected static void createStableBranch(Repository myRepository) throws IOException {
  String newRefName="String_Node_Str";
  RefUpdate updateRef=myRepository.updateRef(newRefName);
  Ref sourceBranch=myRepository.getRef("String_Node_Str");
  ObjectId startAt=sourceBranch.getObjectId();
  String startBranch=myRepository.shortenRefName(sourceBranch.getName());
  updateRef.setNewObjectId(startAt);
  updateRef.setRefLogMessage("String_Node_Str" + startBranch,false);
  updateRef.update();
}

Fixed version (ground truth):
protected static void createStableBranch(Repository myRepository) throws IOException {
  String newRefName="String_Node_Str";
  RefUpdate updateRef=myRepository.updateRef(newRefName);
  Ref sourceBranch=myRepository.getRef("String_Node_Str");
  ObjectId startAt=sourceBranch.getObjectId();
  String startBranch=Repository.shortenRefName(sourceBranch.getName());
  updateRef.setNewObjectId(startAt);
  updateRef.setRefLogMessage("String_Node_Str" + startBranch,false);
  updateRef.update();
}