Program: 7802
Project: 7802
Buggy source:
public StyledString getStyledText(Object element){
  if (!(element instanceof RepositoryTreeNode))   return null;
  RepositoryTreeNode node=(RepositoryTreeNode)element;
  try {
switch (node.getType()) {
case REPO:
      Repository repository=(Repository)node.getObject();
    File directory=repository.getDirectory();
  StyledString string=new StyledString(directory.getParentFile().getName());
string.append("String_Node_Str" + directory.getAbsolutePath(),StyledString.QUALIFIER_STYLER);
string.append("String_Node_Str" + repository.getBranch() + "String_Node_Str",StyledString.DECORATIONS_STYLER);
return string;
case ADDITIONALREF:
Ref ref=(Ref)node.getObject();
StyledString refName=new StyledString(node.getRepository().shortenRefName(ref.getName()));
if (ref.isSymbolic()) {
refName.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
refName.append(ref.getLeaf().getName(),StyledString.QUALIFIER_STYLER);
refName.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
refName.append(ObjectId.toString(ref.getLeaf().getObjectId()),StyledString.QUALIFIER_STYLER);
}
 else {
refName.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
refName.append(ObjectId.toString(ref.getObjectId()),StyledString.QUALIFIER_STYLER);
}
return refName;
case WORKINGDIR:
StyledString dirString=new StyledString(UIText.RepositoriesView_WorkingDir_treenode);
dirString.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
if (node.getRepository().isBare()) {
dirString.append(UIText.RepositoriesViewLabelProvider_BareRepositoryMessage,StyledString.QUALIFIER_STYLER);
}
 else {
dirString.append(node.getRepository().getWorkTree().getAbsolutePath(),StyledString.QUALIFIER_STYLER);
}
return dirString;
case PUSH:
case FETCH:
case FILE:
case FOLDER:
case BRANCHES:
case LOCAL:
case REMOTETRACKING:
case BRANCHHIERARCHY:
case TAGS:
case ADDITIONALREFS:
case REMOTES:
case REMOTE:
case ERROR:
case REF:
case TAG:
{
String label=getSimpleText(node);
if (label != null) return new StyledString(label);
}
}
}
 catch (IOException e) {
Activator.logError(e.getMessage(),e);
}
return null;
}

Fixed version (ground truth):
public StyledString getStyledText(Object element){
  if (!(element instanceof RepositoryTreeNode))   return null;
  RepositoryTreeNode node=(RepositoryTreeNode)element;
  try {
switch (node.getType()) {
case REPO:
      Repository repository=(Repository)node.getObject();
    File directory=repository.getDirectory();
  StyledString string=new StyledString(directory.getParentFile().getName());
string.append("String_Node_Str" + directory.getAbsolutePath(),StyledString.QUALIFIER_STYLER);
string.append("String_Node_Str" + repository.getBranch() + "String_Node_Str",StyledString.DECORATIONS_STYLER);
return string;
case ADDITIONALREF:
Ref ref=(Ref)node.getObject();
StyledString refName=new StyledString(Repository.shortenRefName(ref.getName()));
if (ref.isSymbolic()) {
refName.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
refName.append(ref.getLeaf().getName(),StyledString.QUALIFIER_STYLER);
refName.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
refName.append(ObjectId.toString(ref.getLeaf().getObjectId()),StyledString.QUALIFIER_STYLER);
}
 else {
refName.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
refName.append(ObjectId.toString(ref.getObjectId()),StyledString.QUALIFIER_STYLER);
}
return refName;
case WORKINGDIR:
StyledString dirString=new StyledString(UIText.RepositoriesView_WorkingDir_treenode);
dirString.append("String_Node_Str",StyledString.QUALIFIER_STYLER);
if (node.getRepository().isBare()) {
dirString.append(UIText.RepositoriesViewLabelProvider_BareRepositoryMessage,StyledString.QUALIFIER_STYLER);
}
 else {
dirString.append(node.getRepository().getWorkTree().getAbsolutePath(),StyledString.QUALIFIER_STYLER);
}
return dirString;
case PUSH:
case FETCH:
case FILE:
case FOLDER:
case BRANCHES:
case LOCAL:
case REMOTETRACKING:
case BRANCHHIERARCHY:
case TAGS:
case ADDITIONALREFS:
case REMOTES:
case REMOTE:
case ERROR:
case REF:
case TAG:
{
String label=getSimpleText(node);
if (label != null) return new StyledString(label);
}
}
}
 catch (IOException e) {
Activator.logError(e.getMessage(),e);
}
return null;
}