Program: 40163
Project: 40163
Buggy source:
/** 
 * @param cha
 * @param cl
 * @param fileName
 * @param url
 * @return The set of class names that where defined in the CHA as a resultloading process.
 * @throws IOException
 */
public static Set<String> loadAdditionalFile(IClassHierarchy cha,JavaScriptLoader cl,String fileName,URL url) throws IOException {
  try {
    SourceURLModule M=new SourceURLModule(url);
    TranslatorToCAst toCAst=getTranslatorFactory().make(new CAstImpl(),M);
    final Set<String> names=new HashSet<String>();
    JSAstTranslator toIR=new JSAstTranslator(cl){
      @Override protected void defineFunction(      CAstEntity N,      WalkContext definingContext,      AbstractCFG cfg,      SymbolTable symtab,      boolean hasCatchBlock,      TypeReference[][] caughtTypes,      boolean hasMonitorOp,      AstLexicalInformation LI,      DebuggingInformation debugInfo){
        String fnName="String_Node_Str" + composeEntityName(definingContext,N);
        names.add(fnName);
        super.defineFunction(N,definingContext,cfg,symtab,hasCatchBlock,caughtTypes,hasMonitorOp,LI,debugInfo);
      }
      @Override protected void leaveFunctionStmt(      CAstNode n,      WalkContext c,      CAstVisitor<WalkContext> visitor){
        CAstEntity fn=(CAstEntity)n.getChild(0).getValue();
        Scope cs=c.currentScope();
        if (!cs.contains(fn.getName()) || cs.lookup(fn.getName()).getDefiningScope().getEntity().getKind() == CAstEntity.SCRIPT_ENTITY) {
          int result=processFunctionExpr(n,c);
          assignValue(n,c,cs.lookup(fn.getName()),fn.getName(),result);
        }
 else {
          super.leaveFunctionStmt(n,c,visitor);
        }
      }
    }
;
    CAstEntity tree;
    try {
      tree=toCAst.translateToCAst();
      if (DEBUG) {
        CAstPrinter.printTo(tree,new PrintWriter(System.err));
      }
      toIR.translate(tree,M);
      for (      String name : names) {
        IClass fcls=cl.lookupClass(name,cha);
        cha.addClass(fcls);
      }
      return names;
    }
 catch (    Error e) {
      return Collections.emptySet();
    }
  }
 catch (  RuntimeException e) {
    return Collections.emptySet();
  }
}

Fixed version (ground truth):
/** 
 * @param cha
 * @param cl
 * @param fileName
 * @param url
 * @return The set of class names that where defined in the CHA as a resultloading process.
 * @throws IOException
 */
public static Set<String> loadAdditionalFile(IClassHierarchy cha,JavaScriptLoader cl,String fileName,URL url) throws IOException {
  try {
    SourceURLModule M=new SourceURLModule(url);
    TranslatorToCAst toCAst=getTranslatorFactory().make(new CAstImpl(),M);
    final Set<String> names=new HashSet<String>();
    JSAstTranslator toIR=new JSAstTranslator(cl){
      @Override protected void defineFunction(      CAstEntity N,      WalkContext definingContext,      AbstractCFG cfg,      SymbolTable symtab,      boolean hasCatchBlock,      Map<IBasicBlock,TypeReference[]> caughtTypes,      boolean hasMonitorOp,      AstLexicalInformation LI,      DebuggingInformation debugInfo){
        String fnName="String_Node_Str" + composeEntityName(definingContext,N);
        names.add(fnName);
        super.defineFunction(N,definingContext,cfg,symtab,hasCatchBlock,caughtTypes,hasMonitorOp,LI,debugInfo);
      }
      @Override protected void leaveFunctionStmt(      CAstNode n,      WalkContext c,      CAstVisitor<WalkContext> visitor){
        CAstEntity fn=(CAstEntity)n.getChild(0).getValue();
        Scope cs=c.currentScope();
        if (!cs.contains(fn.getName()) || cs.lookup(fn.getName()).getDefiningScope().getEntity().getKind() == CAstEntity.SCRIPT_ENTITY) {
          int result=processFunctionExpr(n,c);
          assignValue(n,c,cs.lookup(fn.getName()),fn.getName(),result);
        }
 else {
          super.leaveFunctionStmt(n,c,visitor);
        }
      }
    }
;
    CAstEntity tree;
    try {
      tree=toCAst.translateToCAst();
      if (DEBUG) {
        CAstPrinter.printTo(tree,new PrintWriter(System.err));
      }
      toIR.translate(tree,M);
      for (      String name : names) {
        IClass fcls=cl.lookupClass(name,cha);
        cha.addClass(fcls);
      }
      return names;
    }
 catch (    Error e) {
      return Collections.emptySet();
    }
  }
 catch (  RuntimeException e) {
    return Collections.emptySet();
  }
}