Program: 91543
Project: 91543
Buggy source:
void populate() throws IOException {
  if (GitTraceLocation.QUICKDIFF.isActive())   GitTraceLocation.getTrace().traceEntry(GitTraceLocation.QUICKDIFF.getLocation(),resource);
  TreeWalk tw=null;
  RevWalk rw=null;
  try {
    RepositoryMapping mapping=RepositoryMapping.getMapping(resource);
    if (mapping == null) {
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    final String gitPath=mapping.getRepoRelativePath(resource);
    final Repository repository=mapping.getRepository();
    String baseline=GitQuickDiffProvider.baseline.get(repository);
    if (baseline == null)     baseline=Constants.HEAD;
    ObjectId commitId=repository.resolve(baseline);
    if (commitId != null) {
      if (commitId.equals(lastCommit)) {
        if (GitTraceLocation.QUICKDIFF.isActive())         GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str");
        return;
      }
    }
 else {
      String msg=NLS.bind(UIText.GitDocument_errorResolveQuickdiff,new Object[]{baseline,resource,repository});
      Activator.logError(msg,new Throwable());
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    rw=new RevWalk(repository);
    RevCommit baselineCommit;
    try {
      baselineCommit=rw.parseCommit(commitId);
    }
 catch (    IOException err) {
      String msg=NLS.bind(UIText.GitDocument_errorLoadCommit,new Object[]{commitId,baseline,resource,repository});
      Activator.logError(msg,err);
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    RevTree treeId=baselineCommit.getTree();
    if (treeId.equals(lastTree)) {
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str");
      return;
    }
    tw=TreeWalk.forPath(repository,gitPath,treeId);
    ObjectId id=tw.getObjectId(0);
    if (id.equals(ObjectId.zeroId())) {
      setResolved(null,null,null,"String_Node_Str");
      String msg=NLS.bind(UIText.GitDocument_errorLoadTree,new Object[]{treeId,baseline,resource,repository});
      Activator.logError(msg,new Throwable());
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    if (!id.equals(lastBlob)) {
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str" + baseline);
      ObjectLoader loader=repository.open(id,Constants.OBJ_BLOB);
      byte[] bytes=loader.getBytes();
      String charset;
      charset=CompareUtils.getResourceEncoding(resource);
      String s=new String(bytes,charset);
      setResolved(commitId,treeId,id,s);
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str" + s.length() + "String_Node_Str");
    }
 else {
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str");
    }
  }
  finally {
    if (tw != null)     tw.release();
    if (rw != null)     rw.release();
    if (GitTraceLocation.QUICKDIFF.isActive())     GitTraceLocation.getTrace().traceExit(GitTraceLocation.QUICKDIFF.getLocation());
  }
}

Fixed version (ground truth):
void populate() throws IOException {
  if (GitTraceLocation.QUICKDIFF.isActive())   GitTraceLocation.getTrace().traceEntry(GitTraceLocation.QUICKDIFF.getLocation(),resource);
  TreeWalk tw=null;
  RevWalk rw=null;
  try {
    RepositoryMapping mapping=RepositoryMapping.getMapping(resource);
    if (mapping == null) {
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    final String gitPath=mapping.getRepoRelativePath(resource);
    final Repository repository=mapping.getRepository();
    String baseline=GitQuickDiffProvider.baseline.get(repository);
    if (baseline == null)     baseline=Constants.HEAD;
    ObjectId commitId=repository.resolve(baseline);
    if (commitId != null) {
      if (commitId.equals(lastCommit)) {
        if (GitTraceLocation.QUICKDIFF.isActive())         GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str");
        return;
      }
    }
 else {
      String msg=NLS.bind(UIText.GitDocument_errorResolveQuickdiff,new Object[]{baseline,resource,repository});
      Activator.logError(msg,new Throwable());
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    rw=new RevWalk(repository);
    RevCommit baselineCommit;
    try {
      baselineCommit=rw.parseCommit(commitId);
    }
 catch (    IOException err) {
      String msg=NLS.bind(UIText.GitDocument_errorLoadCommit,new Object[]{commitId,baseline,resource,repository});
      Activator.logError(msg,err);
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    RevTree treeId=baselineCommit.getTree();
    if (treeId.equals(lastTree)) {
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str");
      return;
    }
    tw=TreeWalk.forPath(repository,gitPath,treeId);
    if (tw == null) {
      setResolved(null,null,null,"String_Node_Str");
      String msg=NLS.bind(UIText.GitDocument_errorLoadTree,new Object[]{treeId,baseline,resource,repository});
      Activator.logError(msg,new Throwable());
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    ObjectId id=tw.getObjectId(0);
    if (id.equals(ObjectId.zeroId())) {
      setResolved(null,null,null,"String_Node_Str");
      String msg=NLS.bind(UIText.GitDocument_errorLoadTree,new Object[]{treeId,baseline,resource,repository});
      Activator.logError(msg,new Throwable());
      setResolved(null,null,null,"String_Node_Str");
      return;
    }
    if (!id.equals(lastBlob)) {
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str" + baseline);
      ObjectLoader loader=repository.open(id,Constants.OBJ_BLOB);
      byte[] bytes=loader.getBytes();
      String charset;
      charset=CompareUtils.getResourceEncoding(resource);
      String s=new String(bytes,charset);
      setResolved(commitId,treeId,id,s);
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str" + s.length() + "String_Node_Str");
    }
 else {
      if (GitTraceLocation.QUICKDIFF.isActive())       GitTraceLocation.getTrace().trace(GitTraceLocation.QUICKDIFF.getLocation(),"String_Node_Str");
    }
  }
  finally {
    if (tw != null)     tw.release();
    if (rw != null)     rw.release();
    if (GitTraceLocation.QUICKDIFF.isActive())     GitTraceLocation.getTrace().traceExit(GitTraceLocation.QUICKDIFF.getLocation());
  }
}