Program: 83217
Project: 83217
Buggy source:
/** 
 * Call this whenever generators are known to not be running to clear out uncommitted compilation units and to force committed compilation units to be parsed and added to the type oracle.
 * @return types generated during this object's lifetime
 */
public final JClassType[] finish(TreeLogger logger) throws UnableToCompleteException {
  abortUncommittedResources(logger);
  List genTypeNames=new ArrayList();
  try {
    TreeLogger branch;
    if (!committedGeneratedCups.isEmpty()) {
      String msg="String_Node_Str";
      branch=logger.branch(TreeLogger.DEBUG,msg,null);
      TreeLogger subBranch=null;
      if (branch.isLoggable(TreeLogger.DEBUG)) {
        subBranch=branch.branch(TreeLogger.DEBUG,"String_Node_Str",null);
      }
      assert(cacheManager.getTypeOracle() == typeOracle);
      TypeOracleBuilder builder=new TypeOracleBuilder(cacheManager);
      for (Iterator iter=committedGeneratedCups.iterator(); iter.hasNext(); ) {
        GeneratedCompilationUnitProvider gcup=(GeneratedCompilationUnitProvider)iter.next();
        String typeName=gcup.getTypeName();
        String genTypeName=gcup.getPackageName() + "String_Node_Str" + typeName;
        genTypeNames.add(genTypeName);
        CompilationUnitProvider cup=writeSource(logger,gcup,typeName);
        builder.addCompilationUnit(cup);
        if (subBranch != null) {
          subBranch.log(TreeLogger.DEBUG,cup.getLocation(),null);
        }
      }
      cacheManager.markVolatileFiles(committedGeneratedCups);
      builder.build(branch);
    }
    JClassType[] genTypes=new JClassType[genTypeNames.size()];
    int next=0;
    for (Iterator iter=genTypeNames.iterator(); iter.hasNext(); ) {
      String genTypeName=(String)iter.next();
      try {
        genTypes[next++]=typeOracle.getType(genTypeName);
      }
 catch (      NotFoundException e) {
        String msg="String_Node_Str" + genTypeName;
        logger.log(TreeLogger.ERROR,msg,null);
        throw new UnableToCompleteException();
      }
    }
    return genTypes;
  }
  finally {
    if (!uncommittedGeneratedCupsByPrintWriter.isEmpty()) {
      String msg="String_Node_Str";
      logger=logger.branch(TreeLogger.WARN,msg,null);
      for (Iterator iter=uncommittedGeneratedCupsByPrintWriter.values().iterator(); iter.hasNext(); ) {
        StaticCompilationUnitProvider cup=(StaticCompilationUnitProvider)iter.next();
        String typeName=cup.getPackageName() + "String_Node_Str" + cup.getTypeName();
        logger.log(TreeLogger.WARN,typeName,null);
      }
    }
    uncommittedGeneratedCupsByPrintWriter.clear();
    committedGeneratedCups.clear();
    generatedTypeNames.clear();
  }
}

Fixed version (ground truth):
/** 
 * Call this whenever generators are known to not be running to clear out uncommitted compilation units and to force committed compilation units to be parsed and added to the type oracle.
 * @return types generated during this object's lifetime
 */
public final JClassType[] finish(TreeLogger logger) throws UnableToCompleteException {
  abortUncommittedResources(logger);
  List genTypeNames=new ArrayList();
  try {
    TreeLogger branch;
    if (!committedGeneratedCups.isEmpty()) {
      String msg="String_Node_Str";
      branch=logger.branch(TreeLogger.DEBUG,msg,null);
      TreeLogger subBranch=null;
      if (branch.isLoggable(TreeLogger.DEBUG)) {
        subBranch=branch.branch(TreeLogger.DEBUG,"String_Node_Str",null);
      }
      assert(cacheManager.getTypeOracle() == typeOracle);
      TypeOracleBuilder builder=new TypeOracleBuilder(cacheManager);
      for (Iterator iter=committedGeneratedCups.iterator(); iter.hasNext(); ) {
        GeneratedCompilationUnitProvider gcup=(GeneratedCompilationUnitProvider)iter.next();
        String typeName=gcup.getTypeName();
        String genTypeName=gcup.getPackageName() + "String_Node_Str" + typeName;
        genTypeNames.add(genTypeName);
        CompilationUnitProvider cup=writeSource(logger,gcup,typeName);
        builder.addCompilationUnit(cup);
        cacheManager.addGeneratedCup(cup);
        if (subBranch != null) {
          subBranch.log(TreeLogger.DEBUG,cup.getLocation(),null);
        }
      }
      builder.build(branch);
    }
    JClassType[] genTypes=new JClassType[genTypeNames.size()];
    int next=0;
    for (Iterator iter=genTypeNames.iterator(); iter.hasNext(); ) {
      String genTypeName=(String)iter.next();
      try {
        genTypes[next++]=typeOracle.getType(genTypeName);
      }
 catch (      NotFoundException e) {
        String msg="String_Node_Str" + genTypeName;
        logger.log(TreeLogger.ERROR,msg,null);
        throw new UnableToCompleteException();
      }
    }
    return genTypes;
  }
  finally {
    if (!uncommittedGeneratedCupsByPrintWriter.isEmpty()) {
      String msg="String_Node_Str";
      logger=logger.branch(TreeLogger.WARN,msg,null);
      for (Iterator iter=uncommittedGeneratedCupsByPrintWriter.values().iterator(); iter.hasNext(); ) {
        StaticCompilationUnitProvider cup=(StaticCompilationUnitProvider)iter.next();
        String typeName=cup.getPackageName() + "String_Node_Str" + cup.getTypeName();
        logger.log(TreeLogger.WARN,typeName,null);
      }
    }
    uncommittedGeneratedCupsByPrintWriter.clear();
    committedGeneratedCups.clear();
    generatedTypeNames.clear();
  }
}