nus-yam/ex-repair huggingface dataset:
Program: 100364
Project: 100364
Buggy source:
/** 
 * process a basic block that does not have pi nodes
 * @param bb -basic block
 * @param blockInstructionArray -instructions of the basic-block
 */
private void processNoPi(BasicBlock bb,Object[] blockInstructionArray){
  int size=blockInstructionArray.length;
  for (int i=0; i < size; i++) {
    SSAInstruction inst=(SSAInstruction)blockInstructionArray[i];
    Assertions.productionAssertion(inst != null);
    SingleInstructionBasicBlock currBlock=getInstructionBlock(inst);
    if (i < size - 1) {
      SSAInstruction nextInst=(SSAInstruction)blockInstructionArray[i + 1];
      Assertions.productionAssertion(nextInst != null);
      SingleInstructionBasicBlock nextBlock=getInstructionBlock(nextInst);
      addEdge(currBlock,nextBlock);
      fallThroughTargets.put(currBlock,nextBlock);
    }
 else {
      handleLastInstruction(bb,currBlock);
    }
  }
}

Fixed version (ground truth):
/** 
 * process a basic block that does not have pi nodes
 * @param bb -basic block
 * @param blockInstructionArray -instructions of the basic-block
 */
private void processNoPi(BasicBlock bb,Object[] blockInstructionArray){
  int size=blockInstructionArray.length;
  for (int i=0; i < size; i++) {
    SSAInstruction inst=(SSAInstruction)blockInstructionArray[i];
    Assertions.productionAssertion(inst != null);
    SingleInstructionBasicBlock currBlock=getInstructionBlock(inst);
    if (currBlock == null) {
      Assertions.UNREACHABLE("String_Node_Str" + inst);
    }
    if (i < size - 1) {
      SSAInstruction nextInst=(SSAInstruction)blockInstructionArray[i + 1];
      Assertions.productionAssertion(nextInst != null);
      SingleInstructionBasicBlock nextBlock=getInstructionBlock(nextInst);
      addEdge(currBlock,nextBlock);
      fallThroughTargets.put(currBlock,nextBlock);
    }
 else {
      handleLastInstruction(bb,currBlock);
    }
  }
}
Program: 100367
Project: 100367
Buggy source:
/** 
 * map each SSAInstruction to the NormalStatement which represents it.
 */
private static Map<SSAInstruction,NormalStatement> mapInstructionsToStatements(OrdinalSetMapping<Statement> domain){
  Map<SSAInstruction,NormalStatement> ssaInstruction2Statement=HashMapFactory.make();
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.NORMAL)) {
      NormalStatement n=(NormalStatement)s;
      ssaInstruction2Statement.put(n.getInstruction(),n);
    }
  }
  return ssaInstruction2Statement;
}

Fixed version (ground truth):
/** 
 * map each SSAInstruction index to the NormalStatement which represents it.
 */
private static Map<Integer,NormalStatement> mapInstructionsToStatements(OrdinalSetMapping<Statement> domain){
  Map<Integer,NormalStatement> result=HashMapFactory.make();
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.NORMAL)) {
      NormalStatement n=(NormalStatement)s;
      System.err.println("String_Node_Str" + n.getInstructionIndex() + "String_Node_Str"+ n);
      result.put(n.getInstructionIndex(),n);
    }
  }
  return result;
}
Program: 100368
Project: 100368
Buggy source:
private void initHeapReturnCaller(){
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.HEAP_RET_CALLER)) {
      HeapStatement.ReturnCaller r=(ReturnCaller)s;
      NormalStatement call=ssaInstruction2Statement.get(r.getCall());
      int i=domain.getMappedIndex(call);
      int j=domain.getMappedIndex(r);
      heapReturnCaller.add(i,j);
    }
  }
}

Fixed version (ground truth):
private void initHeapReturnCaller(){
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.HEAP_RET_CALLER)) {
      HeapStatement.ReturnCaller r=(ReturnCaller)s;
      NormalStatement call=ssaInstructionIndex2Statement.get(r.getCallIndex());
      int i=domain.getMappedIndex(call);
      int j=domain.getMappedIndex(r);
      heapReturnCaller.add(i,j);
    }
  }
}
Program: 100369
Project: 100369
Buggy source:
/** 
 * @return int set representing the heap def statements that are gen'ed bythe basic block. null if none.
 */
IntSet gen(SingleInstructionBasicBlock b){
  if (b.isEntryBlock()) {
    return heapEntryStatements();
  }
 else {
    SSAInstruction s=b.getInstruction();
    if (s == null) {
      return null;
    }
 else {
      if (s instanceof SSAInvokeInstruction) {
        return heapReturnCaller.getRelated(domain.getMappedIndex(ssaInstruction2Statement.get(s)));
      }
 else {
        Collection<PointerKey> gen=ModRef.getMod(node,h,pa,s,exclusions);
        if (gen.isEmpty()) {
          return null;
        }
 else {
          NormalStatement n=ssaInstruction2Statement.get(s);
          return SparseIntSet.singleton(domain.getMappedIndex(n));
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @return int set representing the heap def statements that are gen'ed bythe basic block. null if none.
 */
IntSet gen(SingleInstructionBasicBlock b){
  if (b.isEntryBlock()) {
    return heapEntryStatements();
  }
 else {
    SSAInstruction s=b.getInstruction();
    if (s == null) {
      return null;
    }
 else {
      if (s instanceof SSAInvokeInstruction) {
        Statement st=ssaInstructionIndex2Statement.get(b.getLastInstructionIndex());
        if (st == null) {
          System.err.println(ssaInstructionIndex2Statement);
          Assertions.UNREACHABLE("String_Node_Str" + b + "String_Node_Str"+ b.getLastInstructionIndex()+ "String_Node_Str"+ s);
        }
        int domainIndex=domain.getMappedIndex(st);
        assert(domainIndex != -1);
        return heapReturnCaller.getRelated(domainIndex);
      }
 else {
        Collection<PointerKey> gen=ModRef.getMod(node,h,pa,s,exclusions);
        if (gen.isEmpty()) {
          return null;
        }
 else {
          NormalStatement n=ssaInstructionIndex2Statement.get(b.getLastInstructionIndex());
          return SparseIntSet.singleton(domain.getMappedIndex(n));
        }
      }
    }
  }
}
Program: 100370
Project: 100370
Buggy source:
RDMap(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement,HeapExclusions exclusions){
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  this.exclusions=exclusions;
  Map<PointerKey,MutableIntSet> pointerKeyMod=initPointerKeyMod(domain,node,h,pa);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  eagerPopulate(pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
}

Fixed version (ground truth):
RDMap(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstructionIndex2Statement,HeapExclusions exclusions){
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  this.exclusions=exclusions;
  Map<PointerKey,MutableIntSet> pointerKeyMod=initPointerKeyMod(domain,node,h,pa);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  eagerPopulate(pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstructionIndex2Statement);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
}
Program: 100371
Project: 100371
Buggy source:
private void eagerPopulate(Map<PointerKey,MutableIntSet> pointerKeyMod,BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement){
  for (  Statement s : domain) {
    delegate.put(s,computeResult(s,pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement));
  }
}

Fixed version (ground truth):
private void eagerPopulate(Map<PointerKey,MutableIntSet> pointerKeyMod,BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstruction2Statement){
  for (  Statement s : domain) {
    delegate.put(s,computeResult(s,pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement));
  }
}
Program: 100372
Project: 100372
Buggy source:
/** 
 * For each statement s, compute the set of statements that may def the heap value read by s.
 * @param mod
 * @param ssaInstruction2Statement
 */
private static Map<Statement,OrdinalSet<Statement>> makeResult(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement,HeapExclusions exclusions){
  return new RDMap(solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement,exclusions);
}

Fixed version (ground truth):
/** 
 * For each statement s, compute the set of statements that may def the heap value read by s.
 */
private static Map<Statement,OrdinalSet<Statement>> makeResult(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstructionIndex2Statement,HeapExclusions exclusions){
  return new RDMap(solver,domain,node,h,pa,mod,cfg,ssaInstructionIndex2Statement,exclusions);
}
Program: 100373
Project: 100373
Buggy source:
public RD(CGNode node,ExpandedControlFlowGraph cfg,PointerAnalysis pa,OrdinalSetMapping<Statement> domain,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement,HeapExclusions exclusions){
  this.node=node;
  this.cfg=cfg;
  this.domain=domain;
  this.pa=pa;
  this.h=new DelegatingExtendedHeapModel(pa.getHeapModel());
  this.ssaInstruction2Statement=ssaInstruction2Statement;
  this.exclusions=exclusions;
  initHeapReturnCaller();
}

Fixed version (ground truth):
public RD(CGNode node,ExpandedControlFlowGraph cfg,PointerAnalysis pa,OrdinalSetMapping<Statement> domain,Map<Integer,NormalStatement> ssaInstructionIndex2Statement,HeapExclusions exclusions){
  this.node=node;
  this.cfg=cfg;
  this.domain=domain;
  this.pa=pa;
  this.h=new DelegatingExtendedHeapModel(pa.getHeapModel());
  this.ssaInstructionIndex2Statement=ssaInstructionIndex2Statement;
  this.exclusions=exclusions;
  initHeapReturnCaller();
}
Program: 100375
Project: 100375
Buggy source:
public ParamCaller(CGNode node,SSAAbstractInvokeInstruction call,PointerKey loc){
  super(node,loc);
  this.call=call;
}

Fixed version (ground truth):
public ParamCaller(CGNode node,int callIndex,PointerKey loc){
  super(node,loc);
  this.callIndex=callIndex;
}
Program: 100376
Project: 100376
Buggy source:
public SSAAbstractInvokeInstruction getCall(){
  return call;
}

Fixed version (ground truth):
public SSAAbstractInvokeInstruction getCall(){
  return (SSAAbstractInvokeInstruction)getNode().getIR().getInstructions()[callIndex];
}
Program: 100377
Project: 100377
Buggy source:
public ReturnCaller(CGNode node,SSAAbstractInvokeInstruction call,PointerKey loc){
  super(node,loc);
  this.call=call;
}

Fixed version (ground truth):
public ReturnCaller(CGNode node,int callIndex,PointerKey loc){
  super(node,loc);
  this.callIndex=callIndex;
}
Program: 100378
Project: 100378
Buggy source:
/** 
 * Create nodes in the graph corresponding to in/out parameter passing for a call instruction
 * @param dOptions
 */
private void addParamPassingStatements(SSAAbstractInvokeInstruction call,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<Statement> params=MapUtil.findOrCreateSet(callerParamStatements,call.getCallSite());
  Collection<Statement> rets=MapUtil.findOrCreateSet(callerReturnStatements,call.getCallSite());
  for (int j=0; j < call.getNumberOfUses(); j++) {
    Statement st=new ParamStatement.ParamCaller(node,call,call.getUse(j));
    addNode(st);
    params.add(st);
  }
  if (!call.getDeclaredResultType().equals(TypeReference.Void)) {
    Statement st=new ParamStatement.NormalReturnCaller(node,call);
    addNode(st);
    rets.add(st);
  }
{
    if (!dOptions.isIgnoreExceptions()) {
      Statement st=new ParamStatement.ExceptionalReturnCaller(node,call);
      addNode(st);
      rets.add(st);
    }
  }
  if (!dOptions.isIgnoreHeap()) {
    OrdinalSet<PointerKey> uref=unionHeapLocations(node,call,ref);
    for (    PointerKey p : uref) {
      Statement st=new HeapStatement.ParamCaller(node,call,p);
      addNode(st);
      params.add(st);
    }
    OrdinalSet<PointerKey> umod=unionHeapLocations(node,call,mod);
    for (    PointerKey p : umod) {
      Statement st=new HeapStatement.ReturnCaller(node,call,p);
      addNode(st);
      rets.add(st);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to in/out parameter passing for a call instruction
 */
private void addParamPassingStatements(int callIndex,Map<CGNode,OrdinalSet<PointerKey>> ref){
  SSAAbstractInvokeInstruction call=(SSAAbstractInvokeInstruction)node.getIR().getInstructions()[callIndex];
  Collection<Statement> params=MapUtil.findOrCreateSet(callerParamStatements,call.getCallSite());
  Collection<Statement> rets=MapUtil.findOrCreateSet(callerReturnStatements,call.getCallSite());
  for (int j=0; j < call.getNumberOfUses(); j++) {
    Statement st=new ParamStatement.ParamCaller(node,call,call.getUse(j));
    addNode(st);
    params.add(st);
  }
  if (!call.getDeclaredResultType().equals(TypeReference.Void)) {
    Statement st=new ParamStatement.NormalReturnCaller(node,call);
    addNode(st);
    rets.add(st);
  }
{
    if (!dOptions.isIgnoreExceptions()) {
      Statement st=new ParamStatement.ExceptionalReturnCaller(node,call);
      addNode(st);
      rets.add(st);
    }
  }
  if (!dOptions.isIgnoreHeap()) {
    OrdinalSet<PointerKey> uref=unionHeapLocations(node,call,ref);
    for (    PointerKey p : uref) {
      Statement st=new HeapStatement.ParamCaller(node,callIndex,p);
      addNode(st);
      params.add(st);
    }
    OrdinalSet<PointerKey> umod=unionHeapLocations(node,call,mod);
    for (    PointerKey p : umod) {
      Statement st=new HeapStatement.ReturnCaller(node,callIndex,p);
      addNode(st);
      rets.add(st);
    }
  }
}
Program: 100379
Project: 100379
Buggy source:
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 * @param options
 */
private Collection<SSAInstruction> createNormalStatements(IR ir,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<SSAInstruction> visited=HashSetFactory.make();
  SSAInstruction[] instructions=ir.getInstructions();
  for (int i=0; i < instructions.length; i++) {
    SSAInstruction s=instructions[i];
    if (s instanceof SSAGetCaughtExceptionInstruction) {
      continue;
    }
    if (s != null) {
      addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements((SSAAbstractInvokeInstruction)s,ref);
    }
  }
  return visited;
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 * @param options
 */
private Collection<SSAInstruction> createNormalStatements(IR ir,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<SSAInstruction> visited=HashSetFactory.make();
  SSAInstruction[] instructions=ir.getInstructions();
  for (int i=0; i < instructions.length; i++) {
    SSAInstruction s=instructions[i];
    if (s instanceof SSAGetCaughtExceptionInstruction) {
      continue;
    }
    if (s != null) {
      addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref);
    }
  }
  return visited;
}
Program: 100380
Project: 100380
Buggy source:
public SourceBuffer(Position p) throws IOException {
  this.p=p;
  this.lines=new String[p.getLastLine() - p.getFirstLine() + 1];
  BufferedReader r=new BufferedReader(new InputStreamReader(p.getInputStream()));
  int line=1;
  while (line <= p.getLastLine()) {
    String theLine=r.readLine();
    if (line >= p.getFirstLine()) {
      lines[line - p.getFirstLine()]=line == p.getLastLine() ? theLine.substring(0,p.getLastCol() + 1) : theLine;
    }
    line++;
  }
}

Fixed version (ground truth):
public SourceBuffer(Position p) throws IOException {
  this.p=p;
  this.lines=new String[p.getLastLine() - p.getFirstLine() + 1];
  BufferedReader r=new BufferedReader(new InputStreamReader(p.getInputStream()));
  int line=1;
  while (line <= p.getLastLine()) {
    String theLine=r.readLine();
    if (line >= p.getFirstLine()) {
      lines[line - p.getFirstLine()]=line == p.getLastLine() ? theLine.substring(0,Math.min(theLine.length(),p.getLastCol() + 1)) : theLine;
    }
    line++;
  }
}
Program: 100381
Project: 100381
Buggy source:
/** 
 * @return TypeReference
 */
public FieldReference getDeclaredField(){
  return field;
}

Fixed version (ground truth):
public FieldReference getDeclaredField(){
  return field;
}
Program: 100382
Project: 100382
Buggy source:
@Override public boolean isPEI(){
  return true;
}

Fixed version (ground truth):
@Override public boolean isPEI(){
  return !isStatic();
}
Program: 100383
Project: 100383
Buggy source:
/** 
 * @return TypeReference
 */
public TypeReference getDeclaredFieldType(){
  return field.getFieldType();
}

Fixed version (ground truth):
public TypeReference getDeclaredFieldType(){
  return field.getFieldType();
}
Program: 100384
Project: 100384
Buggy source:
@Override public Collection<TypeReference> getExceptionTypes(){
  return null;
}

Fixed version (ground truth):
@Override public Collection<TypeReference> getExceptionTypes(){
  return Collections.emptySet();
}
Program: 100385
Project: 100385
Buggy source:
public IField getField(Atom name){
  if (fieldMap.containsKey(name)) {
    return fieldMap.get(name);
  }
 else {
    IField f=findDeclaredField(name);
    if (f != null) {
      fieldMap.put(name,f);
      return f;
    }
 else     if (superClass != null) {
      f=superClass.getField(name);
      if (f != null) {
        fieldMap.put(name,f);
        return f;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public IField getField(Atom name){
  if (fieldMap.containsKey(name)) {
    return fieldMap.get(name);
  }
 else {
    IField f=findDeclaredField(name);
    if (f != null) {
      fieldMap.put(name,f);
      return f;
    }
 else     if (superClass != null) {
      f=superClass.getField(name);
      if (f != null) {
        fieldMap.put(name,f);
        return f;
      }
    }
    try {
      Collection<IClass> ifaces=isInterface() ? getAllAncestorInterfaces() : getAllImplementedInterfaces();
      for (      IClass i : ifaces) {
        f=i.getField(name);
        if (f != null) {
          fieldMap.put(name,f);
          return f;
        }
      }
    }
 catch (    ClassHierarchyException e) {
    }
  }
  return null;
}
Program: 100387
Project: 100387
Buggy source:
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException {
  kludge.add((IJavaElement)match.getElement());
}

Fixed version (ground truth):
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException {
  result.add((IMethod)match.getElement());
}
Program: 100388
Project: 100388
Buggy source:
/** 
 * Find the IType in the workspace corresponding to a class name. TODO: this is too slow. find a better way.
 * @return null if not found
 */
public static IType findJavaClassInWorkspace(String className){
  SearchPattern p=SearchPattern.createPattern(className,IJavaSearchConstants.CLASS,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_EXACT_MATCH);
  IJavaSearchScope scope=SearchEngine.createWorkspaceScope();
  SearchEngine engine=new SearchEngine();
  final Collection<IJavaElement> kludge=HashSetFactory.make();
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match) throws CoreException {
      kludge.add((IJavaElement)match.getElement());
    }
  }
;
  try {
    engine.search(p,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  if (kludge.size() == 1) {
    System.err.println("String_Node_Str" + className);
    return (IType)kludge.iterator().next();
  }
 else {
    System.err.println("String_Node_Str" + className);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Find the IType in the workspace corresponding to a class name. TODO: this is too slow. find a better way.
 * @return null if not found
 */
public static IType findJavaClassInWorkspace(String className){
  SearchPattern p=SearchPattern.createPattern(className,IJavaSearchConstants.CLASS_AND_INTERFACE,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_EXACT_MATCH);
  IJavaSearchScope scope=SearchEngine.createWorkspaceScope();
  SearchEngine engine=new SearchEngine();
  final Collection<IJavaElement> kludge=HashSetFactory.make();
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match) throws CoreException {
      kludge.add((IJavaElement)match.getElement());
    }
  }
;
  try {
    engine.search(p,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  if (kludge.size() == 1) {
    System.err.println("String_Node_Str" + className);
    return (IType)kludge.iterator().next();
  }
 else {
    System.err.println("String_Node_Str" + className);
    return null;
  }
}
Program: 100389
Project: 100389
Buggy source:
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
private static JarFileModule getFromPlugin(String fileName) throws IOException {
  URL url=getFileURLFromPlugin(fileName);
  return (url == null) ? null : new JarFileModule(new JarFile(filePathFromURL(url)));
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
private static JarFileModule getFromPlugin(Plugin p,String fileName) throws IOException {
  URL url=getFileURLFromPlugin(p,fileName);
  return (url == null) ? null : new JarFileModule(new JarFile(filePathFromURL(url)));
}
Program: 100390
Project: 100390
Buggy source:
/** 
 * get a file URL for a file from a plugin
 * @param fileName the file name
 * @return the URL, or <code>null</code> if the file is not found
 * @throws IOException
 */
private static URL getFileURLFromPlugin(String fileName) throws IOException {
  URL url=FileLocator.find(CorePlugin.getDefault().getBundle(),new Path(fileName),null);
  if (url == null) {
    fileName="String_Node_Str" + fileName;
    url=FileLocator.find(CorePlugin.getDefault().getBundle(),new Path(fileName),null);
    if (url == null) {
      return null;
    }
  }
  url=FileLocator.toFileURL(url);
  url=fixupFileURLSpaces(url);
  return url;
}

Fixed version (ground truth):
/** 
 * get a file URL for a file from a plugin
 * @param fileName the file name
 * @return the URL, or <code>null</code> if the file is not found
 * @throws IOException
 */
private static URL getFileURLFromPlugin(Plugin p,String fileName) throws IOException {
  URL url=FileLocator.find(p.getBundle(),new Path(fileName),null);
  if (url == null) {
    fileName="String_Node_Str" + fileName;
    url=FileLocator.find(p.getBundle(),new Path(fileName),null);
    if (url == null) {
      return null;
    }
  }
  url=FileLocator.toFileURL(url);
  url=fixupFileURLSpaces(url);
  return url;
}
Program: 100391
Project: 100391
Buggy source:
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
private static File getFileFromPlugin(String fileName) throws IOException {
  URL url=getFileURLFromPlugin(fileName);
  if (url == null) {
    throw new FileNotFoundException(fileName);
  }
  return new File(filePathFromURL(url));
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
public static File getFileFromPlugin(Plugin p,String fileName) throws IOException {
  URL url=getFileURLFromPlugin(p,fileName);
  if (url == null) {
    throw new FileNotFoundException(fileName);
  }
  return new File(filePathFromURL(url));
}
Program: 100392
Project: 100392
Buggy source:
/** 
 */
public static File getFile(String fileName) throws IOException {
  return (CorePlugin.getDefault() == null) ? getFileFromClassLoader(fileName) : getFileFromPlugin(fileName);
}

Fixed version (ground truth):
/** 
 */
public static File getFile(String fileName) throws IOException {
  return (CorePlugin.getDefault() == null) ? getFileFromClassLoader(fileName) : getFileFromPlugin(CorePlugin.getDefault(),fileName);
}
Program: 100393
Project: 100393
Buggy source:
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
public static Module getJarFileModule(String fileName) throws IOException {
  if (CorePlugin.getDefault() == null) {
    return getJarFileFromClassLoader(fileName);
  }
 else {
    try {
      IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
      IFile file=workspaceRoot.getFile(new Path(fileName));
      if (file != null) {
        return new JarFileModule(new JarFile(fileName,false));
      }
    }
 catch (    Exception e) {
    }
    return getFromPlugin(fileName);
  }
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
public static Module getJarFileModule(String fileName) throws IOException {
  if (CorePlugin.getDefault() == null) {
    return getJarFileFromClassLoader(fileName);
  }
 else {
    try {
      IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
      IFile file=workspaceRoot.getFile(new Path(fileName));
      if (file != null) {
        return new JarFileModule(new JarFile(fileName,false));
      }
    }
 catch (    Exception e) {
    }
    return getFromPlugin(CorePlugin.getDefault(),fileName);
  }
}
Program: 100394
Project: 100394
Buggy source:
/** 
 * Add allocation statements to the fake root method for each possible value of parameter i. If necessary, add a phi to combine the values.
 * @param m
 * @param i
 * @return value number holding the parameter to the call; -1 if there wassome error
 */
protected int makeArgument(FakeRootMethod m,int i,WarningSet warnings){
  TypeReference[] p=getParameterTypes(i);
  if (p.length == 1) {
    SSANewInstruction n=m.addAllocation(p[0],warnings);
    return (n == null) ? -1 : n.getDef();
  }
 else {
    int[] values=new int[p.length];
    int countErrors=0;
    for (int j=0; j < p.length; j++) {
      SSANewInstruction n=m.addAllocation(p[j],warnings);
      int value=(n == null) ? -1 : n.getDef();
      if (value == -1) {
        countErrors++;
      }
 else {
        values[j - countErrors]=value;
      }
    }
    if (countErrors > 0) {
      int[] oldValues=values;
      values=new int[oldValues.length - countErrors];
      System.arraycopy(oldValues,0,values,0,values.length);
    }
    return m.addPhi(values);
  }
}

Fixed version (ground truth):
/** 
 * Add allocation statements to the fake root method for each possible value of parameter i. If necessary, add a phi to combine the values.
 * @param m
 * @param i
 * @return value number holding the parameter to the call; -1 if there wassome error
 */
protected int makeArgument(FakeRootMethod m,int i,WarningSet warnings){
  TypeReference[] p=getParameterTypes(i);
  if (p.length == 0) {
    return -1;
  }
 else   if (p.length == 1) {
    SSANewInstruction n=m.addAllocation(p[0],warnings);
    return (n == null) ? -1 : n.getDef();
  }
 else {
    int[] values=new int[p.length];
    int countErrors=0;
    for (int j=0; j < p.length; j++) {
      SSANewInstruction n=m.addAllocation(p[j],warnings);
      int value=(n == null) ? -1 : n.getDef();
      if (value == -1) {
        countErrors++;
      }
 else {
        values[j - countErrors]=value;
      }
    }
    if (countErrors > 0) {
      int[] oldValues=values;
      values=new int[oldValues.length - countErrors];
      System.arraycopy(oldValues,0,values,0,values.length);
    }
    return m.addPhi(values);
  }
}
Program: 100395
Project: 100395
Buggy source:
/** 
 * Add a call to this entrypoint from the fake root method
 * @param m the Fake Root Method
 * @return the call instruction added, or null if the operation fails
 */
public SSAAbstractInvokeInstruction addCall(FakeRootMethod m,WarningSet warnings){
  int paramValues[];
  CallSiteReference site=makeSite(0);
  if (site == null) {
    return null;
  }
  paramValues=new int[getNumberOfParameters()];
  for (int j=0; j < paramValues.length; j++) {
    paramValues[j]=makeArgument(m,j,warnings);
  }
  return m.addInvocation(paramValues,site);
}

Fixed version (ground truth):
/** 
 * Add a call to this entrypoint from the fake root method
 * @param m the Fake Root Method
 * @return the call instruction added, or null if the operation fails
 */
public SSAAbstractInvokeInstruction addCall(FakeRootMethod m,WarningSet warnings){
  int paramValues[];
  CallSiteReference site=makeSite(0);
  if (site == null) {
    return null;
  }
  paramValues=new int[getNumberOfParameters()];
  for (int j=0; j < paramValues.length; j++) {
    paramValues[j]=makeArgument(m,j,warnings);
    if (paramValues[j] == -1) {
      return null;
    }
  }
  return m.addInvocation(paramValues,site);
}
Program: 100396
Project: 100396
Buggy source:
/** 
 * @param method
 */
protected TypeReference[][] makeParameterTypes(IMethod method){
  TypeReference[][] result=new TypeReference[method.getNumberOfParameters()][];
  for (int i=0; i < result.length; i++) {
    TypeReference t=method.getParameterType(i);
    IClass klass=cha.lookupClass(t);
    if (klass == null) {
      t=null;
    }
 else     if (klass.isAbstract()) {
      t=chooseAConcreteSubClass(klass);
    }
 else     if (klass.isInterface()) {
      t=chooseAnImplementor(klass);
    }
 else     if (klass.isArrayClass()) {
      ArrayClass arrayKlass=(ArrayClass)klass;
      IClass innermost=arrayKlass.getInnermostElementClass();
      if (innermost != null && innermost.isInterface()) {
        TypeReference impl=chooseAnImplementor(innermost);
        if (impl == null) {
          t=null;
        }
 else {
          t=TypeReference.findOrCreateArrayOf(impl);
          for (int dim=1; dim < arrayKlass.getDimensionality(); dim++) {
            t=TypeReference.findOrCreateArrayOf(t);
          }
        }
      }
    }
    result[i]=(t == null) ? new TypeReference[0] : new TypeReference[]{t};
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param method
 */
protected TypeReference[][] makeParameterTypes(IMethod method){
  TypeReference[][] result=new TypeReference[method.getNumberOfParameters()][];
  for (int i=0; i < result.length; i++) {
    TypeReference t=method.getParameterType(i);
    if (!t.isPrimitiveType()) {
      IClass klass=cha.lookupClass(t);
      if (klass == null) {
        t=null;
      }
 else       if (klass.isAbstract()) {
        t=chooseAConcreteSubClass(klass);
      }
 else       if (klass.isInterface()) {
        t=chooseAnImplementor(klass);
      }
 else       if (klass.isArrayClass()) {
        ArrayClass arrayKlass=(ArrayClass)klass;
        IClass innermost=arrayKlass.getInnermostElementClass();
        if (innermost != null && innermost.isInterface()) {
          TypeReference impl=chooseAnImplementor(innermost);
          if (impl == null) {
            t=null;
          }
 else {
            t=TypeReference.findOrCreateArrayOf(impl);
            for (int dim=1; dim < arrayKlass.getDimensionality(); dim++) {
              t=TypeReference.findOrCreateArrayOf(t);
            }
          }
        }
      }
    }
    result[i]=(t == null) ? new TypeReference[0] : new TypeReference[]{t};
  }
  return result;
}
Program: 100397
Project: 100397
Buggy source:
public TypeName getRawName(){
  String s=rawString().substring(0,rawString().length() - 1);
  s=s.replaceAll("String_Node_Str","String_Node_Str");
  return TypeName.string2TypeName(s);
}

Fixed version (ground truth):
/** 
 * Return the name of the raw type for this signature
 */
public TypeName getRawName(){
  StringBuffer s=new StringBuffer();
  StringTokenizer t=new StringTokenizer(rawString(),"String_Node_Str");
  while (t.hasMoreTokens()) {
    String x=t.nextToken();
    s.append(x.replaceAll("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
    if (t.hasMoreElements()) {
      s.append('$');
    }
  }
  return TypeName.string2TypeName(s.toString());
}
Program: 100399
Project: 100399
Buggy source:
public static void deleteContents(String directory) throws WalaException {
  Collection fl=listFiles(directory,null,true);
  for (Iterator it=fl.iterator(); it.hasNext(); ) {
    File f=(File)it.next();
    if (!f.isDirectory()) {
      f.delete();
    }
  }
  Collection f2=listFiles(directory,null,true);
  for (Iterator it=f2.iterator(); it.hasNext(); ) {
    File f=(File)it.next();
    f.delete();
  }
}

Fixed version (ground truth):
/** 
 * delete all files (recursively) in a directory. This is dangerous. Use with care.
 */
public static void deleteContents(String directory) throws WalaException {
  Collection fl=listFiles(directory,null,true);
  for (Iterator it=fl.iterator(); it.hasNext(); ) {
    File f=(File)it.next();
    if (!f.isDirectory()) {
      f.delete();
    }
  }
  do {
    Collection f2=listFiles(directory,null,true);
    for (Iterator it=f2.iterator(); it.hasNext(); ) {
      File f=(File)it.next();
      f.delete();
    }
  }
 while (listFiles(directory,null,true).size() > 0);
}
Program: 100400
Project: 100400
Buggy source:
public ExplodedSupergraph(ISupergraph<T,?> supergraph,IFlowFunctionMap flowFunctions){
  this.supergraph=supergraph;
  this.flowFunctions=flowFunctions;
}

Fixed version (ground truth):
public ExplodedSupergraph(ISupergraph<T,?> supergraph,IFlowFunctionMap<T> flowFunctions){
  this.supergraph=supergraph;
  this.flowFunctions=flowFunctions;
}
Program: 100402
Project: 100402
Buggy source:
public Iterator<ExplodedSupergraphNode<T>> getSuccNodes(ExplodedSupergraphNode<T> node){
  T src=node.getSupergraphNode();
  HashSet<ExplodedSupergraphNode<T>> result=HashSetFactory.make(supergraph.getSuccNodeCount(src));
  for (Iterator<? extends T> it=supergraph.getSuccNodes(src); it.hasNext(); ) {
    T dest=it.next();
    if (supergraph.classifyEdge(src,dest) != ISupergraph.RETURN_EDGE) {
      IUnaryFlowFunction f=(IUnaryFlowFunction)getFlowFunction(src,dest);
      IntSet targets=f.getTargets(node.getFact());
      if (targets != null) {
        for (IntIterator ii=targets.intIterator(); ii.hasNext(); ) {
          int t=ii.next();
          result.add(new ExplodedSupergraphNode<T>(dest,t));
        }
      }
    }
 else {
      for (Iterator it2=supergraph.getCallSites(dest); it2.hasNext(); ) {
        Object callBlock=it2.next();
        IUnaryFlowFunction f=(IUnaryFlowFunction)flowFunctions.getReturnFlowFunction(callBlock,src,dest);
        IntSet targets=f.getTargets(node.getFact());
        if (targets != null) {
          for (IntIterator ii=targets.intIterator(); ii.hasNext(); ) {
            int t=ii.next();
            result.add(new ExplodedSupergraphNode<T>(dest,t));
          }
        }
      }
    }
  }
  return result.iterator();
}

Fixed version (ground truth):
public Iterator<ExplodedSupergraphNode<T>> getSuccNodes(ExplodedSupergraphNode<T> node){
  T src=node.getSupergraphNode();
  HashSet<ExplodedSupergraphNode<T>> result=HashSetFactory.make(supergraph.getSuccNodeCount(src));
  for (Iterator<? extends T> it=supergraph.getSuccNodes(src); it.hasNext(); ) {
    T dest=it.next();
    if (supergraph.classifyEdge(src,dest) != ISupergraph.RETURN_EDGE) {
      IUnaryFlowFunction f=(IUnaryFlowFunction)getFlowFunction(src,dest);
      IntSet targets=f.getTargets(node.getFact());
      if (targets != null) {
        for (IntIterator ii=targets.intIterator(); ii.hasNext(); ) {
          int t=ii.next();
          result.add(new ExplodedSupergraphNode<T>(dest,t));
        }
      }
    }
 else {
      for (Iterator<? extends T> it2=supergraph.getCallSites(dest); it2.hasNext(); ) {
        T callBlock=it2.next();
        IUnaryFlowFunction f=(IUnaryFlowFunction)flowFunctions.getReturnFlowFunction(callBlock,src,dest);
        IntSet targets=f.getTargets(node.getFact());
        if (targets != null) {
          for (IntIterator ii=targets.intIterator(); ii.hasNext(); ) {
            int t=ii.next();
            result.add(new ExplodedSupergraphNode<T>(dest,t));
          }
        }
      }
    }
  }
  return result.iterator();
}
Program: 100403
Project: 100403
Buggy source:
/** 
 * @param supergraph
 * @param flowFunctions
 * @param solver
 */
public ExplodedSupergraphWithSummaryEdges(ISupergraph<T,?> supergraph,IFlowFunctionMap flowFunctions,TabulationSolver<T,?> solver){
  super(supergraph,flowFunctions);
  this.solver=solver;
}

Fixed version (ground truth):
/** 
 * @param supergraph
 * @param flowFunctions
 * @param solver
 */
public ExplodedSupergraphWithSummaryEdges(ISupergraph<T,?> supergraph,IFlowFunctionMap<T> flowFunctions,TabulationSolver<T,?> solver){
  super(supergraph,flowFunctions);
  this.solver=solver;
}
Program: 100404
Project: 100404
Buggy source:
/** 
 * @param src
 * @param dest
 * @return the flow function for a "call-to-return" edge in the supergraphfrom src->dest, when the supergraph does not contain any callees of src. This happens via, e.g., slicing.
 */
public IUnaryFlowFunction getCallNoneToReturnFlowFunction(Object src,Object dest);

Fixed version (ground truth):
/** 
 * @param src
 * @param dest
 * @return the flow function for a "call-to-return" edge in the supergraphfrom src->dest, when the supergraph does not contain any callees of src. This happens via, e.g., slicing.
 */
public IUnaryFlowFunction getCallNoneToReturnFlowFunction(T src,T dest);
Program: 100405
Project: 100405
Buggy source:
/** 
 * @param call supergraph node of the call instruction for this return edge.
 * @param src
 * @param dest
 * @return the flow function for a "return" edge in the supergraph fromsrc->dest
 */
public IFlowFunction getReturnFlowFunction(Object call,Object src,Object dest);

Fixed version (ground truth):
/** 
 * @param call supergraph node of the call instruction for this return edge.
 * @param src
 * @param dest
 * @return the flow function for a "return" edge in the supergraph fromsrc->dest
 */
public IFlowFunction getReturnFlowFunction(T call,T src,T dest);
Program: 100406
Project: 100406
Buggy source:
/** 
 * @param src
 * @param dest
 * @return the flow function for a "call" edge in the supergraph fromsrc->dest
 */
public IUnaryFlowFunction getCallFlowFunction(Object src,Object dest);

Fixed version (ground truth):
/** 
 * @param src
 * @param dest
 * @return the flow function for a "call" edge in the supergraph fromsrc->dest
 */
public IUnaryFlowFunction getCallFlowFunction(T src,T dest);
Program: 100407
Project: 100407
Buggy source:
/** 
 * @param src
 * @param dest
 * @return the flow function for a "normal" edge in the supergraph fromsrc->dest
 */
public IUnaryFlowFunction getNormalFlowFunction(Object src,Object dest);

Fixed version (ground truth):
/** 
 * @param src
 * @param dest
 * @return the flow function for a "normal" edge in the supergraph fromsrc->dest
 */
public IUnaryFlowFunction getNormalFlowFunction(T src,T dest);
Program: 100408
Project: 100408
Buggy source:
/** 
 * @param src
 * @param dest
 * @return the flow function for a "call-to-return" edge in the supergraphfrom src->dest
 */
public IUnaryFlowFunction getCallToReturnFlowFunction(Object src,Object dest);

Fixed version (ground truth):
/** 
 * @param src
 * @param dest
 * @return the flow function for a "call-to-return" edge in the supergraphfrom src->dest
 */
public IUnaryFlowFunction getCallToReturnFlowFunction(T src,T dest);
Program: 100409
Project: 100409
Buggy source:
public static IdentityFlowFunctions singleton(){
  return SINGLETON;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <T>IdentityFlowFunctions<T> singleton(){
  return SINGLETON;
}
Program: 100410
Project: 100410
Buggy source:
public IFlowFunctionMap getFunctionMap();

Fixed version (ground truth):
public IFlowFunctionMap<T> getFunctionMap();
Program: 100411
Project: 100411
Buggy source:
public IUnaryFlowFunction getCallNoneToReturnFlowFunction(Object src,Object dest){
  Statement s=(Statement)src;
switch (s.getKind()) {
case NORMAL_RET_CALLER:
case PARAM_CALLER:
    return ReachabilityFunctions.killReachability;
case HEAP_PARAM_CALLEE:
case HEAP_PARAM_CALLER:
case HEAP_RET_CALLEE:
case HEAP_RET_CALLER:
  if (dest instanceof HeapStatement) {
    HeapStatement hd=(HeapStatement)dest;
    HeapStatement hs=(HeapStatement)src;
    if (hs.getLocation().equals(hd.getLocation())) {
      return IdentityFlowFunction.identity();
    }
 else {
      return ReachabilityFunctions.killReachability;
    }
  }
 else {
    return ReachabilityFunctions.killReachability;
  }
default :
Assertions.UNREACHABLE(s.getKind().toString());
return null;
}
}

Fixed version (ground truth):
public IUnaryFlowFunction getCallNoneToReturnFlowFunction(Statement src,Statement dest){
  Statement s=(Statement)src;
switch (s.getKind()) {
case NORMAL_RET_CALLER:
case PARAM_CALLER:
    return ReachabilityFunctions.killReachability;
case HEAP_PARAM_CALLEE:
case HEAP_PARAM_CALLER:
case HEAP_RET_CALLEE:
case HEAP_RET_CALLER:
  if (dest instanceof HeapStatement) {
    HeapStatement hd=(HeapStatement)dest;
    HeapStatement hs=(HeapStatement)src;
    if (hs.getLocation().equals(hd.getLocation())) {
      return IdentityFlowFunction.identity();
    }
 else {
      return ReachabilityFunctions.killReachability;
    }
  }
 else {
    return ReachabilityFunctions.killReachability;
  }
default :
Assertions.UNREACHABLE(s.getKind().toString());
return null;
}
}
Program: 100412
Project: 100412
Buggy source:
public IFlowFunction getReturnFlowFunction(Object call,Object src,Object dest){
  return ReachabilityFunctions.singleton().getReturnFlowFunction(call,src,dest);
}

Fixed version (ground truth):
public IFlowFunction getReturnFlowFunction(Statement call,Statement src,Statement dest){
  return ReachabilityFunctions.singleton().getReturnFlowFunction(call,src,dest);
}
Program: 100413
Project: 100413
Buggy source:
public IUnaryFlowFunction getCallFlowFunction(Object src,Object dest){
  return ReachabilityFunctions.singleton().getCallFlowFunction(src,dest);
}

Fixed version (ground truth):
public IUnaryFlowFunction getCallFlowFunction(Statement src,Statement dest){
  return ReachabilityFunctions.singleton().getCallFlowFunction(src,dest);
}
Program: 100414
Project: 100414
Buggy source:
public IUnaryFlowFunction getNormalFlowFunction(Object src,Object dest){
  return ReachabilityFunctions.singleton().getNormalFlowFunction(src,dest);
}

Fixed version (ground truth):
public IUnaryFlowFunction getNormalFlowFunction(Statement src,Statement dest){
  return ReachabilityFunctions.singleton().getNormalFlowFunction(src,dest);
}
Program: 100415
Project: 100415
Buggy source:
public IUnaryFlowFunction getCallToReturnFlowFunction(Object src,Object dest){
  return ReachabilityFunctions.singleton().getCallToReturnFlowFunction(src,dest);
}

Fixed version (ground truth):
public IUnaryFlowFunction getCallToReturnFlowFunction(Statement src,Statement dest){
  return ReachabilityFunctions.singleton().getCallToReturnFlowFunction(src,dest);
}
Program: 100416
Project: 100416
Buggy source:
public IFlowFunctionMap getFunctionMap(){
  return f;
}

Fixed version (ground truth):
public IFlowFunctionMap<Statement> getFunctionMap(){
  return f;
}
Program: 100417
Project: 100417
Buggy source:
/** 
 * Method newPhi.
 * @param rhs
 * @return int
 */
public int newPhi(int[] rhs){
  int result=getNewValueNumber();
  SSAPhiInstruction phi=new SSAPhiInstruction(result,(int[])rhs.clone());
  values[result]=new PhiValue(phi);
  return result;
}

Fixed version (ground truth):
/** 
 * Method newPhi.
 * @param rhs
 * @return int
 */
public int newPhi(int[] rhs) throws IllegalArgumentException {
  int result=getNewValueNumber();
  SSAPhiInstruction phi=new SSAPhiInstruction(result,(int[])rhs.clone());
  values[result]=new PhiValue(phi);
  return result;
}
Program: 100418
Project: 100418
Buggy source:
public static IWorkspace getWorkspace(){
  return ResourcesPlugin.getWorkspace();
}

Fixed version (ground truth):
/** 
 * @return null if there's a problem
 */
public static IWorkspace getWorkspace(){
  try {
    return ResourcesPlugin.getWorkspace();
  }
 catch (  Throwable t) {
    return null;
  }
}
Program: 100419
Project: 100419
Buggy source:
@SuppressWarnings("String_Node_Str") private static ECallGraph loadFromFile(String fileName,ClassLoader loader){
  Resource r=new XMIResourceImpl(URI.createURI(fileName));
  XMLResource.XMLMap xmlMap=new XMLMapImpl();
  xmlMap.setNoNamespacePackage(CallGraphPackage.eINSTANCE);
  Map<String,XMLMap> options=new HashMap<String,XMLMap>();
  options.put(XMLResource.OPTION_XML_MAP,xmlMap);
  try {
    r.load(options);
  }
 catch (  IOException e) {
    InputStream s=loader.getResourceAsStream(fileName);
    Assertions.productionAssertion(s != null,"String_Node_Str" + fileName);
    ResourceSet resSet=new ResourceSetImpl();
    r=resSet.createResource(URI.createURI("String_Node_Str"));
    options=new HashMap<String,XMLMap>();
    try {
      r.load(s,options);
    }
 catch (    IOException e2) {
      e2.printStackTrace();
      Assertions.UNREACHABLE("String_Node_Str" + fileName);
    }
  }
  EList contents=r.getContents();
  for (Iterator<EObject> it=contents.iterator(); it.hasNext(); ) {
    Object o=it.next();
    if (o instanceof ECallGraph) {
      return (ECallGraph)o;
    }
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static ECallGraph loadFromFile(String fileName,ClassLoader loader) throws IllegalArgumentException {
  Resource r=new XMIResourceImpl(URI.createURI(fileName));
  XMLResource.XMLMap xmlMap=new XMLMapImpl();
  xmlMap.setNoNamespacePackage(CallGraphPackage.eINSTANCE);
  Map<String,XMLMap> options=new HashMap<String,XMLMap>();
  options.put(XMLResource.OPTION_XML_MAP,xmlMap);
  try {
    r.load(options);
  }
 catch (  IOException e) {
    InputStream s=loader.getResourceAsStream(fileName);
    if (s == null) {
      throw new IllegalArgumentException("String_Node_Str" + fileName);
    }
    ResourceSet resSet=new ResourceSetImpl();
    r=resSet.createResource(URI.createURI("String_Node_Str"));
    options=new HashMap<String,XMLMap>();
    try {
      r.load(s,options);
    }
 catch (    IOException e2) {
      e2.printStackTrace();
      Assertions.UNREACHABLE("String_Node_Str" + fileName);
    }
  }
  EList contents=r.getContents();
  for (Iterator<EObject> it=contents.iterator(); it.hasNext(); ) {
    Object o=it.next();
    if (o instanceof ECallGraph) {
      return (ECallGraph)o;
    }
  }
  return null;
}
Program: 100420
Project: 100420
Buggy source:
@SuppressWarnings("String_Node_Str") public static ECallGraphWrapper load(String fileName,ClassLoader loader){
  ECallGraph G=loadFromFile(fileName,loader);
  Assertions.productionAssertion(G != null);
  ECallGraphWrapper result=new ECallGraphWrapper();
  for (Iterator<EPair> it=G.getNodes().getContents().iterator(); it.hasNext(); ) {
    result.addNode(it.next());
  }
  for (Iterator<EPair> it=G.getEdges().getContents().iterator(); it.hasNext(); ) {
    EPair p=it.next();
    result.addEdge(p.getX(),p.getY());
  }
  return result;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static ECallGraphWrapper load(String fileName,ClassLoader loader) throws IllegalArgumentException {
  ECallGraph G=loadFromFile(fileName,loader);
  Assertions.productionAssertion(G != null);
  ECallGraphWrapper result=new ECallGraphWrapper();
  for (Iterator<EPair> it=G.getNodes().getContents().iterator(); it.hasNext(); ) {
    result.addNode(it.next());
  }
  for (Iterator<EPair> it=G.getEdges().getContents().iterator(); it.hasNext(); ) {
    EPair p=it.next();
    result.addEdge(p.getX(),p.getY());
  }
  return result;
}