Program: 186782
Project: 186782
Buggy source:
private Set<ClassInfo> findDependencies(ClassInfo cli,MethodInfo method,boolean inRec){
  Set<ClassInfo> depends=new HashSet<ClassInfo>();
  if (method.isNative() || method.isAbstract()) {
    return depends;
  }
  ConstantPoolGen cpoolgen=cli.getConstantPoolGen();
  ConstantPool cpool=cpoolgen.getConstantPool();
  InstructionList il=method.getCode().getInstructionList();
  InstructionFinder f=new InstructionFinder(il);
  String cpInstr="String_Node_Str";
  for (Iterator it=f.search(cpInstr); it.hasNext(); ) {
    InstructionHandle[] match=(InstructionHandle[])it.next();
    InstructionHandle first=match[0];
    CPInstruction ii=(CPInstruction)first.getInstruction();
    int idx=ii.getIndex();
    Constant co=cpoolgen.getConstant(idx);
    ConstantClass cocl=null;
    Set addDepends=null;
    String clname;
    ClassInfo clinfo;
    MethodInfo minfo;
switch (co.getTag()) {
case Constants.CONSTANT_Class:
      cocl=(ConstantClass)co;
    clname=cocl.getBytes(cpool).replace('/','.');
  clinfo=cli.getAppInfo().getClassInfo(clname);
if (clinfo != null) {
  minfo=clinfo.getMethodInfo("String_Node_Str");
  if (minfo != null) {
    addDepends=findDependencies(clinfo,minfo,true);
  }
}
break;
case Constants.CONSTANT_InterfaceMethodref:
cocl=(ConstantClass)cpoolgen.getConstant(((ConstantInterfaceMethodref)co).getClassIndex());
break;
case Constants.CONSTANT_Methodref:
cocl=(ConstantClass)cpoolgen.getConstant(((ConstantMethodref)co).getClassIndex());
clname=cocl.getBytes(cpool).replace('/','.');
clinfo=cli.getAppInfo().getClassInfo(clname);
int sigidx=((ConstantMethodref)co).getNameAndTypeIndex();
ConstantNameAndType signt=(ConstantNameAndType)cpool.getConstant(sigidx);
String sigstr=signt.getName(cpool) + signt.getSignature(cpool);
if (clinfo != null) {
minfo=clinfo.getMethodInfo(sigstr);
if (minfo != null) {
addDepends=findDependencies(clinfo,minfo,true);
}
}
break;
case Constants.CONSTANT_Fieldref:
cocl=(ConstantClass)cpool.getConstant(((ConstantFieldref)co).getClassIndex());
break;
}
if (cocl != null) {
clname=cocl.getBytes(cpool).replace('/','.');
ClassInfo clinf=cli.getAppInfo().getClassInfo(clname);
if (clinf != null) {
if (clinf.getMethodInfo(clinitSig) != null) {
if (clinf != cli) {
depends.add(clinf);
}
}
}
}
if (addDepends != null) {
for (Object addDepend : addDepends) {
ClassInfo addCli=(ClassInfo)addDepend;
if (addCli == cli) {
throw new JavaClassFormatError("String_Node_Str");
}
depends.add(addCli);
}
}
}
il.dispose();
return depends;
}

Fixed version (ground truth):
private Set<ClassInfo> findDependencies(MethodInfo method,boolean inRec){
  Set<ClassInfo> depends=new HashSet<ClassInfo>();
  if (method.isNative() || method.isAbstract()) {
    return depends;
  }
  ConstantPoolGen cpoolgen=method.getConstantPoolGen();
  ConstantPool cpool=cpoolgen.getConstantPool();
  InstructionList il=method.getCode().getInstructionList();
  InstructionFinder f=new InstructionFinder(il);
  String cpInstr="String_Node_Str";
  for (Iterator it=f.search(cpInstr); it.hasNext(); ) {
    InstructionHandle[] match=(InstructionHandle[])it.next();
    InstructionHandle first=match[0];
    CPInstruction ii=(CPInstruction)first.getInstruction();
    int idx=ii.getIndex();
    Constant co=cpoolgen.getConstant(idx);
    ConstantClass cocl=null;
    Set addDepends=null;
    String clname;
    ClassInfo clinfo;
    MethodInfo minfo;
switch (co.getTag()) {
case Constants.CONSTANT_Class:
      cocl=(ConstantClass)co;
    clname=cocl.getBytes(cpool).replace('/','.');
  clinfo=method.getAppInfo().getClassInfo(clname);
if (clinfo != null) {
  minfo=clinfo.getMethodInfo("String_Node_Str");
  if (minfo != null) {
    addDepends=findDependencies(minfo,true);
  }
}
break;
case Constants.CONSTANT_InterfaceMethodref:
cocl=(ConstantClass)cpoolgen.getConstant(((ConstantInterfaceMethodref)co).getClassIndex());
break;
case Constants.CONSTANT_Methodref:
cocl=(ConstantClass)cpoolgen.getConstant(((ConstantMethodref)co).getClassIndex());
clname=cocl.getBytes(cpool).replace('/','.');
clinfo=method.getAppInfo().getClassInfo(clname);
int sigidx=((ConstantMethodref)co).getNameAndTypeIndex();
ConstantNameAndType signt=(ConstantNameAndType)cpool.getConstant(sigidx);
String sigstr=signt.getName(cpool) + signt.getSignature(cpool);
if (clinfo != null) {
minfo=clinfo.getMethodInfo(sigstr);
if (minfo != null) {
addDepends=findDependencies(minfo,true);
}
}
break;
case Constants.CONSTANT_Fieldref:
cocl=(ConstantClass)cpool.getConstant(((ConstantFieldref)co).getClassIndex());
break;
}
if (cocl != null) {
clname=cocl.getBytes(cpool).replace('/','.');
ClassInfo clinf=method.getAppInfo().getClassInfo(clname);
if (clinf != null) {
if (clinf.getMethodInfo(clinitSig) != null) {
if (!clinf.equals(method.getClassInfo())) {
depends.add(clinf);
}
}
}
}
if (addDepends != null) {
for (Object addDepend : addDepends) {
ClassInfo addCli=(ClassInfo)addDepend;
if (addCli.equals(method.getClassInfo())) {
throw new JavaClassFormatError("String_Node_Str");
}
depends.add(addCli);
}
}
}
return depends;
}