nus-yam/ex-repair huggingface dataset:
Program: 25677
Project: 25677
Buggy source:
public static List<ParcelableSetting> migrateSettings(Context context,int uid){
  List<ParcelableSetting> listWork=new ArrayList<ParcelableSetting>();
  File prefFile=new File(getPrefFileName(PREF_SETTINGS,uid));
  File migratedFile=new File(prefFile + "String_Node_Str");
  if (prefFile.exists() && !migratedFile.exists()) {
    Util.log(null,Log.WARN,"String_Node_Str" + prefFile);
    SharedPreferences prefs=context.getSharedPreferences(PREF_SETTINGS + "String_Node_Str" + uid,Context.MODE_WORLD_READABLE);
    for (    String settingKey : prefs.getAll().keySet())     try {
      String name=getSettingName(settingKey);
      String value=prefs.getString(settingKey,"String_Node_Str");
      listWork.add(new ParcelableSetting(uid,name,value));
    }
 catch (    Throwable ex) {
      Util.bug(null,ex);
    }
  }
  return listWork;
}

Fixed version (ground truth):
public static List<ParcelableSetting> migrateSettings(Context context,int uid){
  List<ParcelableSetting> listWork=new ArrayList<ParcelableSetting>();
  File prefFile=new File(getPrefFileName(PREF_SETTINGS,uid));
  File migratedFile=new File(prefFile + "String_Node_Str");
  if (prefFile.exists() && !migratedFile.exists()) {
    Util.log(null,Log.WARN,"String_Node_Str" + prefFile);
    SharedPreferences prefs=context.getSharedPreferences(PREF_SETTINGS + "String_Node_Str" + uid,Context.MODE_WORLD_READABLE);
    for (    String name : prefs.getAll().keySet())     try {
      String value=prefs.getString(name,"String_Node_Str");
      listWork.add(new ParcelableSetting(uid,name,value));
    }
 catch (    Throwable ex) {
      Util.bug(null,ex);
    }
  }
  return listWork;
}
Program: 25678
Project: 25678
Buggy source:
public void setScrollTo(int position){
  mScrollTo=position;
}

Fixed version (ground truth):
public void setScrollTo(AppHolder app){
  mScrollTo=app;
}
Program: 25679
Project: 25679
Buggy source:
public void setState(int uid,int state,String message){
  AppHolder app=mAppsByUid.get(uid);
  app.message=message;
  if (mActionId == R.string.menu_import && mAppsWaiting.contains(app)) {
    mAppsWaiting.remove(app);
    mAppsDone.add(app);
    this.setNotifyOnChange(false);
    this.clear();
    this.addAll(mAppsDone);
    this.addAll(mAppsWaiting);
  }
  app.state=state;
  changeNotifier.setScrollTo(mAppAdapter.getPosition(app));
  runOnUiThread(changeNotifier);
}

Fixed version (ground truth):
public void setState(int uid,int state,String message){
  AppHolder app=mAppsByUid.get(uid);
  app.message=message;
  app.state=state;
  changeNotifier.setScrollTo(app);
  runOnUiThread(changeNotifier);
}
Program: 25682
Project: 25682
Buggy source:
public static List<ApplicationInfoEx> getXApplicationList(Context context,ProgressDialog dialog){
  PackageManager pm=context.getPackageManager();
  boolean fSystem=PrivacyManager.getSettingBool(null,context,PrivacyManager.cSettingFSystem,true,false);
  SparseArray<ApplicationInfoEx> mapApp=new SparseArray<ApplicationInfoEx>();
  List<ApplicationInfoEx> listApp=new ArrayList<ApplicationInfoEx>();
  List<ApplicationInfo> listAppInfo=pm.getInstalledApplications(PackageManager.GET_META_DATA);
  dialog.setMax(listAppInfo.size());
  for (int app=0; app < listAppInfo.size(); app++)   try {
    dialog.setProgress(app + 1);
    ApplicationInfoEx xAppInfo=new ApplicationInfoEx(context,listAppInfo.get(app));
    if (fSystem ? !(xAppInfo.isFrozen() || xAppInfo.getIsSystem()) : true) {
      ApplicationInfoEx yAppInfo=mapApp.get(xAppInfo.getUid());
      if (yAppInfo == null) {
        mapApp.put(xAppInfo.getUid(),xAppInfo);
        listApp.add(xAppInfo);
      }
 else       yAppInfo.AddApplicationName(getApplicationName(listAppInfo.get(app),pm));
    }
  }
 catch (  Throwable ex) {
    Util.bug(null,ex);
  }
  Collections.sort(listApp);
  return listApp;
}

Fixed version (ground truth):
public static List<ApplicationInfoEx> getXApplicationList(Context context,ProgressDialog dialog){
  PackageManager pm=context.getPackageManager();
  SparseArray<ApplicationInfoEx> mapApp=new SparseArray<ApplicationInfoEx>();
  List<ApplicationInfoEx> listApp=new ArrayList<ApplicationInfoEx>();
  List<ApplicationInfo> listAppInfo=pm.getInstalledApplications(PackageManager.GET_META_DATA);
  dialog.setMax(listAppInfo.size());
  for (int app=0; app < listAppInfo.size(); app++)   try {
    dialog.setProgress(app + 1);
    ApplicationInfoEx xAppInfo=new ApplicationInfoEx(context,listAppInfo.get(app));
    ApplicationInfoEx yAppInfo=mapApp.get(xAppInfo.getUid());
    if (yAppInfo == null) {
      mapApp.put(xAppInfo.getUid(),xAppInfo);
      listApp.add(xAppInfo);
    }
 else     yAppInfo.AddApplicationName(getApplicationName(listAppInfo.get(app),pm));
  }
 catch (  Throwable ex) {
    Util.bug(null,ex);
  }
  Collections.sort(listApp);
  return listApp;
}
Program: 25683
Project: 25683
Buggy source:
@Override protected List<XApplicationInfo> doInBackground(String... params){
  return XApplicationInfo.getXApplicationList(XActivityRestriction.this,params[0]);
}

Fixed version (ground truth):
@Override protected List<XApplicationInfo> doInBackground(String... params){
  mRestrictionName=params[0];
  return XApplicationInfo.getXApplicationList(XActivityRestriction.this,mRestrictionName);
}
Program: 25684
Project: 25684
Buggy source:
/** 
 * Loads a class file by a given class loader. <p>This first tries to use   {@code sun.misc.Unsafe} to load a class.Then it tries to use a  {@code protected} method in {@code java.lang.ClassLoader}via   {@code PrivilegedAction}.  Since the latter approach is not available any longer by default in Java 9 or later, the JVM argument  {@code --add-opens java.base/java.lang=ALL-UNNAMED} must be given to the JVM.If this JVM argument cannot be given,  {@link #toPublicClass(String,byte[])}should be used instead. </p>
 * @param domain        if it is null, a default domain is used.
 * @since 3.22
 */
public static Class<?> toClass(String className,ClassLoader loader,ProtectionDomain domain,byte[] bcode) throws CannotCompileException {
  try {
    return privileged.defineClass(className,bcode,0,bcode.length,loader,domain);
  }
 catch (  RuntimeException e) {
    throw e;
  }
catch (  ClassFormatError e) {
    throw new CannotCompileException(e.getCause());
  }
catch (  Exception e) {
    throw new CannotCompileException(e);
  }
}

Fixed version (ground truth):
/** 
 * Loads a class file by a given class loader. <p>This first tries to use   {@code sun.misc.Unsafe} to load a class.Then it tries to use a  {@code protected} method in {@code java.lang.ClassLoader}via   {@code PrivilegedAction}.  Since the latter approach is not available any longer by default in Java 9 or later, the JVM argument  {@code --add-opens java.base/java.lang=ALL-UNNAMED} must be given to the JVM.If this JVM argument cannot be given,  {@link #toPublicClass(String,byte[])}should be used instead. </p>
 * @param domain        if it is null, a default domain is used.
 * @since 3.22
 */
public static Class<?> toClass(String className,ClassLoader loader,ProtectionDomain domain,byte[] bcode) throws CannotCompileException {
  try {
    return privileged.defineClass(className,bcode,0,bcode.length,loader,domain);
  }
 catch (  RuntimeException e) {
    throw e;
  }
catch (  ClassFormatError e) {
    Throwable t=e.getCause();
    throw new CannotCompileException(t == null ? e : t);
  }
catch (  Exception e) {
    throw new CannotCompileException(e);
  }
}
Program: 25685
Project: 25685
Buggy source:
/** 
 * Returns true if the class has the specified annotation class.
 * @param clz the name of annotation class.
 * @return <code>true</code> if the annotation is found,otherwise <code>false</code>.
 * @since 3.11
 */
public boolean hasAnnotation(String clz){
  MethodInfo mi=getMethodInfo2();
  AnnotationsAttribute ainfo=(AnnotationsAttribute)mi.getAttribute(AnnotationsAttribute.invisibleTag);
  AnnotationsAttribute ainfo2=(AnnotationsAttribute)mi.getAttribute(AnnotationsAttribute.visibleTag);
  return CtClassType.hasAnnotationType(clz,getDeclaringClass().getClassPool(),ainfo,ainfo2);
}

Fixed version (ground truth):
/** 
 * Returns true if the class has the specified annotation type.
 * @param typeName      the name of annotation type.
 * @return <code>true</code> if the annotation is found,otherwise <code>false</code>.
 * @since 3.21
 */
public boolean hasAnnotation(String typeName){
  MethodInfo mi=getMethodInfo2();
  AnnotationsAttribute ainfo=(AnnotationsAttribute)mi.getAttribute(AnnotationsAttribute.invisibleTag);
  AnnotationsAttribute ainfo2=(AnnotationsAttribute)mi.getAttribute(AnnotationsAttribute.visibleTag);
  return CtClassType.hasAnnotationType(typeName,getDeclaringClass().getClassPool(),ainfo,ainfo2);
}
Program: 25686
Project: 25686
Buggy source:
/** 
 * Returns true if the class has the specified annotation class.
 * @param annotClzName the name of annotation class.
 * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
 * @since 3.11
 */
public boolean hasAnnotation(String annotClzName){
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if the class has the specified annotation type.
 * @param annotationTypeName the name of annotation type.
 * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
 * @since 3.21
 */
public boolean hasAnnotation(String annotationTypeName){
  return false;
}
Program: 25687
Project: 25687
Buggy source:
/** 
 * Returns the annotation if the class has the specified annotation class. For example, if an annotation <code>@Author</code> is associated with this class, an <code>Author</code> object is returned. The member values can be obtained by calling methods on the <code>Author</code> object.
 * @param clz the annotation class.
 * @return the annotation if found, otherwise <code>null</code>.
 * @since 3.11
 */
public Object getAnnotation(Class clz) throws ClassNotFoundException {
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the annotation if the class has the specified annotation type. For example, if an annotation <code>@Author</code> is associated with this class, an <code>Author</code> object is returned. The member values can be obtained by calling methods on the <code>Author</code> object.
 * @param clz the annotation type.
 * @return the annotation if found, otherwise <code>null</code>.
 * @since 3.11
 */
public Object getAnnotation(Class clz) throws ClassNotFoundException {
  return null;
}
Program: 25688
Project: 25688
Buggy source:
public boolean hasAnnotation(String annotClzName){
  ClassFile cf=getClassFile2();
  AnnotationsAttribute ainfo=(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.invisibleTag);
  AnnotationsAttribute ainfo2=(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.visibleTag);
  return hasAnnotationType(annotClzName,getClassPool(),ainfo,ainfo2);
}

Fixed version (ground truth):
public boolean hasAnnotation(String annotationName){
  ClassFile cf=getClassFile2();
  AnnotationsAttribute ainfo=(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.invisibleTag);
  AnnotationsAttribute ainfo2=(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.visibleTag);
  return hasAnnotationType(annotationName,getClassPool(),ainfo,ainfo2);
}
Program: 25689
Project: 25689
Buggy source:
static boolean hasAnnotationType(String annotationClzNm,ClassPool cp,AnnotationsAttribute a1,AnnotationsAttribute a2){
  Annotation[] anno1, anno2;
  if (a1 == null)   anno1=null;
 else   anno1=a1.getAnnotations();
  if (a2 == null)   anno2=null;
 else   anno2=a2.getAnnotations();
  String typeName=annotationClzNm;
  if (anno1 != null)   for (int i=0; i < anno1.length; i++)   if (anno1[i].getTypeName().equals(typeName))   return true;
  if (anno2 != null)   for (int i=0; i < anno2.length; i++)   if (anno2[i].getTypeName().equals(typeName))   return true;
  return false;
}

Fixed version (ground truth):
static boolean hasAnnotationType(String annotationTypeName,ClassPool cp,AnnotationsAttribute a1,AnnotationsAttribute a2){
  Annotation[] anno1, anno2;
  if (a1 == null)   anno1=null;
 else   anno1=a1.getAnnotations();
  if (a2 == null)   anno2=null;
 else   anno2=a2.getAnnotations();
  if (anno1 != null)   for (int i=0; i < anno1.length; i++)   if (anno1[i].getTypeName().equals(annotationTypeName))   return true;
  if (anno2 != null)   for (int i=0; i < anno2.length; i++)   if (anno2[i].getTypeName().equals(annotationTypeName))   return true;
  return false;
}
Program: 25690
Project: 25690
Buggy source:
/** 
 * Returns true if the class has the specified annotation class.
 * @param clz the name of annotation class.
 * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
 * @since 3.11
 */
public boolean hasAnnotation(String clz){
  FieldInfo fi=getFieldInfo2();
  AnnotationsAttribute ainfo=(AnnotationsAttribute)fi.getAttribute(AnnotationsAttribute.invisibleTag);
  AnnotationsAttribute ainfo2=(AnnotationsAttribute)fi.getAttribute(AnnotationsAttribute.visibleTag);
  return CtClassType.hasAnnotationType(clz,getDeclaringClass().getClassPool(),ainfo,ainfo2);
}

Fixed version (ground truth):
/** 
 * Returns true if the class has the specified annotation type.
 * @param typeName      the name of annotation type.
 * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
 * @since 3.21
 */
public boolean hasAnnotation(String typeName){
  FieldInfo fi=getFieldInfo2();
  AnnotationsAttribute ainfo=(AnnotationsAttribute)fi.getAttribute(AnnotationsAttribute.invisibleTag);
  AnnotationsAttribute ainfo2=(AnnotationsAttribute)fi.getAttribute(AnnotationsAttribute.visibleTag);
  return CtClassType.hasAnnotationType(typeName,getDeclaringClass().getClassPool(),ainfo,ainfo2);
}
Program: 25691
Project: 25691
Buggy source:
/** 
 * Returns true if the class has the specified annotation class.
 * @param annotClzName the name of annotation class.
 * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
 * @since 3.11
 */
public abstract boolean hasAnnotation(String annotClzName);

Fixed version (ground truth):
/** 
 * Returns true if the class has the specified annotation type.
 * @param annotationTypeName the name of annotation type.
 * @return <code>true</code> if the annotation is found, otherwise <code>false</code>.
 * @since 3.21
 */
public abstract boolean hasAnnotation(String annotationTypeName);
Program: 25692
Project: 25692
Buggy source:
/** 
 * Returns the annotation if the class has the specified annotation class. For example, if an annotation <code>@Author</code> is associated with this member, an <code>Author</code> object is returned. The member values can be obtained by calling methods on the <code>Author</code> object.
 * @param clz the annotation class.
 * @return the annotation if found, otherwise <code>null</code>.
 * @since 3.11
 */
public abstract Object getAnnotation(Class clz) throws ClassNotFoundException ;

Fixed version (ground truth):
/** 
 * Returns the annotation if the class has the specified annotation type. For example, if an annotation <code>@Author</code> is associated with this member, an <code>Author</code> object is returned. The member values can be obtained by calling methods on the <code>Author</code> object.
 * @param annotationType    the annotation type.
 * @return the annotation if found, otherwise <code>null</code>.
 * @since 3.11
 */
public abstract Object getAnnotation(Class annotationType) throws ClassNotFoundException ;
Program: 25693
Project: 25693
Buggy source:
private static MethodInfo makeDelegator(Method meth,String desc,ConstPool cp,Class declClass,String delegatorName){
  MethodInfo delegator=new MethodInfo(cp,delegatorName,desc);
  delegator.setAccessFlags(Modifier.FINAL | Modifier.PUBLIC | (meth.getModifiers() & ~(Modifier.PRIVATE | Modifier.PROTECTED | Modifier.ABSTRACT| Modifier.NATIVE| Modifier.SYNCHRONIZED)));
  setThrows(delegator,cp,meth);
  Bytecode code=new Bytecode(cp,0,0);
  code.addAload(0);
  int s=addLoadParameters(code,meth.getParameterTypes(),1);
  code.addInvokespecial(declClass.isInterface(),cp.addClassInfo(declClass.getName()),meth.getName(),desc);
  addReturn(code,meth.getReturnType());
  code.setMaxLocals(++s);
  delegator.setCodeAttribute(code.toCodeAttribute());
  return delegator;
}

Fixed version (ground truth):
private MethodInfo makeDelegator(Method meth,String desc,ConstPool cp,Class declClass,String delegatorName){
  MethodInfo delegator=new MethodInfo(cp,delegatorName,desc);
  delegator.setAccessFlags(Modifier.FINAL | Modifier.PUBLIC | (meth.getModifiers() & ~(Modifier.PRIVATE | Modifier.PROTECTED | Modifier.ABSTRACT| Modifier.NATIVE| Modifier.SYNCHRONIZED)));
  setThrows(delegator,cp,meth);
  Bytecode code=new Bytecode(cp,0,0);
  code.addAload(0);
  int s=addLoadParameters(code,meth.getParameterTypes(),1);
  Class targetClass=invokespecialTarget(declClass);
  code.addInvokespecial(targetClass.isInterface(),cp.addClassInfo(targetClass.getName()),meth.getName(),desc);
  addReturn(code,meth.getReturnType());
  code.setMaxLocals(++s);
  delegator.setCodeAttribute(code.toCodeAttribute());
  return delegator;
}
Program: 25694
Project: 25694
Buggy source:
public int foo(){
  return 4;
}

Fixed version (ground truth):
public int foo(){
  return Default2.super.foo();
}
Program: 25695
Project: 25695
Buggy source:
@Override public Object invoke(Object self,Method thisMethod,Method proceed,Object[] args) throws Throwable {
  value244+=thisMethod.getDeclaringClass().getName();
  return proceed.invoke(self);
}

Fixed version (ground truth):
public Object invoke(Object self,Method m,Method proceed,Object[] args) throws Throwable {
  valueDefaultMethods+="String_Node_Str";
  return proceed.invoke(self,args);
}
Program: 25696
Project: 25696
Buggy source:
public int bar(int i){
  return i + 1;
}

Fixed version (ground truth):
default int bar(){
  return 1;
}
Program: 25697
Project: 25697
Buggy source:
private Class createClass1(){
  if (thisClass == null) {
    ClassLoader cl=getClassLoader();
synchronized (proxyCache) {
      if (factoryUseCache)       createClass2(cl);
 else       createClass3(cl);
    }
  }
  Class result=thisClass;
  thisClass=null;
  return result;
}

Fixed version (ground truth):
private Class createClass1(){
  Class result=thisClass;
  if (result == null) {
    ClassLoader cl=getClassLoader();
synchronized (proxyCache) {
      if (factoryUseCache)       createClass2(cl);
 else       createClass3(cl);
      result=thisClass;
      thisClass=null;
    }
  }
  return result;
}
Program: 25698
Project: 25698
Buggy source:
private void makeBehaviorCache(CtMember.Cache cache){
  List list=getClassFile2().getMethods();
  int n=list.size();
  for (int i=0; i < n; ++i) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    if (minfo.isMethod()) {
      CtMethod newMethod=new CtMethod(minfo,this);
      cache.addMethod(newMethod);
    }
 else {
      CtConstructor newCons=new CtConstructor(minfo,this);
      cache.addConstructor(newCons);
    }
  }
}

Fixed version (ground truth):
private void makeBehaviorCache(CtMember.Cache cache){
  List list=getClassFile3(false).getMethods();
  int n=list.size();
  for (int i=0; i < n; ++i) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    if (minfo.isMethod()) {
      CtMethod newMethod=new CtMethod(minfo,this);
      cache.addMethod(newMethod);
    }
 else {
      CtConstructor newCons=new CtConstructor(minfo,this);
      cache.addConstructor(newCons);
    }
  }
}
Program: 25699
Project: 25699
Buggy source:
private void makeFieldCache(CtMember.Cache cache){
  List list=getClassFile2().getFields();
  int n=list.size();
  for (int i=0; i < n; ++i) {
    FieldInfo finfo=(FieldInfo)list.get(i);
    CtField newField=new CtField(finfo,this);
    cache.addField(newField);
  }
}

Fixed version (ground truth):
private void makeFieldCache(CtMember.Cache cache){
  List list=getClassFile3(false).getFields();
  int n=list.size();
  for (int i=0; i < n; ++i) {
    FieldInfo finfo=(FieldInfo)list.get(i);
    CtField newField=new CtField(finfo,this);
    cache.addField(newField);
  }
}
Program: 25700
Project: 25700
Buggy source:
public ClassFile getClassFile2(){
  ClassFile cfile=classfile;
  if (cfile != null)   return cfile;
  classPool.compress();
  if (rawClassfile != null) {
    try {
      classfile=new ClassFile(new DataInputStream(new ByteArrayInputStream(rawClassfile)));
      rawClassfile=null;
      getCount=GET_THRESHOLD;
      return classfile;
    }
 catch (    IOException e) {
      throw new RuntimeException(e.toString(),e);
    }
  }
  InputStream fin=null;
  try {
    fin=classPool.openClassfile(getName());
    if (fin == null)     throw new NotFoundException(getName());
    fin=new BufferedInputStream(fin);
    ClassFile cf=new ClassFile(new DataInputStream(fin));
    if (!cf.getName().equals(qualifiedName))     throw new RuntimeException("String_Node_Str" + qualifiedName + "String_Node_Str"+ cf.getName()+ "String_Node_Str"+ qualifiedName.replace('.','/')+ "String_Node_Str");
    classfile=cf;
    return cf;
  }
 catch (  NotFoundException e) {
    throw new RuntimeException(e.toString(),e);
  }
catch (  IOException e) {
    throw new RuntimeException(e.toString(),e);
  }
 finally {
    if (fin != null)     try {
      fin.close();
    }
 catch (    IOException e) {
    }
  }
}

Fixed version (ground truth):
public ClassFile getClassFile2(){
  return getClassFile3(true);
}
Program: 25701
Project: 25701
Buggy source:
/** 
 * Returns null if members are not cached.
 */
protected CtMember.Cache hasMemberCache(){
  if (memberCache != null)   return (CtMember.Cache)memberCache.get();
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns null if members are not cached.
 */
protected CtMember.Cache hasMemberCache(){
  WeakReference cache=memberCache;
  if (cache != null)   return (CtMember.Cache)cache.get();
 else   return null;
}
Program: 25702
Project: 25702
Buggy source:
/** 
 * Obtains the value of the member.
 * @return fully-qualified class name.
 */
public String getValue(){
  String v=cp.getUtf8Info(valueIndex);
  try {
    return SignatureAttribute.toTypeSignature(v).toString();
  }
 catch (  BadBytecode e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Obtains the value of the member.
 * @return fully-qualified class name.
 */
public String getValue(){
  String v=cp.getUtf8Info(valueIndex);
  try {
    return SignatureAttribute.toTypeSignature(v).jvmTypeName();
  }
 catch (  BadBytecode e) {
    throw new RuntimeException(e);
  }
}
Program: 25703
Project: 25703
Buggy source:
/** 
 * Obtains the string representation of this object.
 */
public String toString(){
  return getValue() + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Obtains the string representation of this object.
 */
public String toString(){
  return getValue().replace('$','.') + "String_Node_Str";
}
Program: 25704
Project: 25704
Buggy source:
public static void main(String[] args) throws Exception {
  ClassPool cp=ClassPool.getDefault();
  CtClass newClass=cp.makeClass("String_Node_Str");
  addDeadCode(newClass,"String_Node_Str" + "String_Node_Str");
  newClass.debugWriteFile();
  Class<?> cClass=newClass.toClass();
  Object o=cClass.newInstance();
  java.lang.reflect.Method m=cClass.getMethod("String_Node_Str");
  m.invoke(o);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length > 1) {
    new Test().bar(3);
    return;
  }
  ClassPool cp=ClassPool.getDefault();
  CtClass str=cp.get("String_Node_Str");
  CtClass cc=cp.get("String_Node_Str");
  cc.getClassFile().setMajorVersion(javassist.bytecode.ClassFile.JAVA_4);
  CtMethod m=cc.getDeclaredMethod("String_Node_Str");
  m.addLocalVariable("String_Node_Str",str);
  m.insertAfter("String_Node_Str",true);
  cc.getClassFile().setMajorVersion(javassist.bytecode.ClassFile.JAVA_7);
  m.insertBefore("String_Node_Str");
  cc.writeFile();
}
Program: 25705
Project: 25705
Buggy source:
/** 
 * Returns the type name in the JVM internal style. For example, if the type is a nested class   {@code foo.Bar.Baz}, then   {@code foo.Bar$Baz} is returned.
 */
public String jvmTypeName(){
  StringBuffer sbuf=new StringBuffer();
  ClassType parent=getDeclaringClass();
  if (parent != null)   sbuf.append(parent.jvmTypeName()).append('$');
  sbuf.append(name);
  if (arguments != null) {
    sbuf.append('<');
    int n=arguments.length;
    for (int i=0; i < n; i++) {
      if (i > 0)       sbuf.append("String_Node_Str");
      sbuf.append(arguments[i].toString());
    }
    sbuf.append('>');
  }
  return sbuf.toString();
}

Fixed version (ground truth):
/** 
 * Returns the type name in the JVM internal style. For example, if the type is a nested class   {@code foo.Bar.Baz}, then   {@code foo.Bar$Baz} is returned.
 */
public String jvmTypeName(){
  StringBuffer sbuf=new StringBuffer();
  ClassType parent=getDeclaringClass();
  if (parent != null)   sbuf.append(parent.jvmTypeName()).append('$');
  return toString2(sbuf);
}
Program: 25706
Project: 25706
Buggy source:
private Hashtable getInvalidNames(){
  Hashtable ht=invalidNames;
  if (ht == null) {
synchronized (MemberResolver.class) {
      ht=(Hashtable)invalidNamesMap.get(classPool);
      if (ht == null) {
        ht=new Hashtable();
        invalidNamesMap.put(classPool,ht);
      }
    }
    invalidNames=ht;
  }
  return ht;
}

Fixed version (ground truth):
private Hashtable getInvalidNames(){
  Hashtable ht=invalidNames;
  if (ht == null) {
synchronized (MemberResolver.class) {
      WeakReference ref=(WeakReference)invalidNamesMap.get(classPool);
      if (ref != null)       ht=(Hashtable)ref.get();
      if (ht == null) {
        ht=new Hashtable();
        invalidNamesMap.put(classPool,new WeakReference(ht));
      }
    }
    invalidNames=ht;
  }
  return ht;
}
Program: 25707
Project: 25707
Buggy source:
public static void main(String[] args){
  for (int loop=0; loop < 5; loop++) {
    try {
      implTestClassTailCache();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  for (int loop=0; loop < 5; loop++) {
    try {
      implTestClassTailCache();
      for (int i=0; i < 100; i++)       implTestClassTailCache2();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  System.out.println("String_Node_Str" + javassist.compiler.MemberResolver.getInvalidMapSize());
}
Program: 25708
Project: 25708
Buggy source:
/** 
 * @param useCache      false if the cached CtClass must be ignored.
 * @param searchParent  false if the parent class pool is not searched.
 * @return null     if the class could not be found.
 */
protected synchronized CtClass get0(String classname,boolean useCache) throws NotFoundException {
  CtClass clazz=null;
  if (useCache) {
    clazz=getCached(classname);
    if (clazz != null)     return clazz;
  }
  if (!childFirstLookup && parent != null) {
    clazz=parent.get0(classname,useCache);
    if (clazz != null)     return clazz;
  }
  clazz=createCtClass(classname,useCache);
  if (clazz != null) {
    if (useCache)     cacheCtClass(classname,clazz,false);
    return clazz;
  }
  if (childFirstLookup && parent != null)   clazz=parent.get0(classname,useCache);
  return clazz;
}

Fixed version (ground truth):
/** 
 * @param useCache      false if the cached CtClass must be ignored.
 * @param searchParent  false if the parent class pool is not searched.
 * @return null     if the class could not be found.
 */
protected synchronized CtClass get0(String classname,boolean useCache) throws NotFoundException {
  CtClass clazz=null;
  if (useCache) {
    clazz=getCached(classname);
    if (clazz != null)     return clazz;
  }
  if (!childFirstLookup && parent != null) {
    clazz=parent.get0(classname,useCache);
    if (clazz != null)     return clazz;
  }
  clazz=createCtClass(classname,useCache);
  if (clazz != null) {
    if (useCache)     cacheCtClass(clazz.getName(),clazz,false);
    return clazz;
  }
  if (childFirstLookup && parent != null)   clazz=parent.get0(classname,useCache);
  return clazz;
}
Program: 25709
Project: 25709
Buggy source:
/** 
 * Reads <code>CONSTANT_Class_info</code> structure at the given index.
 * @return  a fully-qualified class or interface name specifiedby <code>name_index</code>.
 */
public String getClassInfo(int index){
  ClassInfo c=(ClassInfo)getItem(index);
  if (c == null)   return null;
 else   return Descriptor.toJavaName(getUtf8Info(c.name));
}

Fixed version (ground truth):
/** 
 * Reads <code>CONSTANT_Class_info</code> structure at the given index.
 * @return  a fully-qualified class or interface name specifiedby <code>name_index</code>.  If the type is an array type, this method returns an encoded name like <code>[java.lang.Object;</code> (note that the separators are not slashes but dots).
 * @see javassist.ClassPool#getCtClass(String)
 */
public String getClassInfo(int index){
  ClassInfo c=(ClassInfo)getItem(index);
  if (c == null)   return null;
 else   return Descriptor.toJavaName(getUtf8Info(c.name));
}
Program: 25710
Project: 25710
Buggy source:
/** 
 * Converts a class name from the internal representation used in the JVM to the normal one used in Java.
 */
public static String toJavaName(String classname){
  return classname.replace('/','.');
}

Fixed version (ground truth):
/** 
 * Converts a class name from the internal representation used in the JVM to the normal one used in Java. This method does not deal with an array type name such as "[Ljava/lang/Object;" and "[I;".  For such names, use <code>toClassName()</code>.
 * @see #toClassName(String)
 */
public static String toJavaName(String classname){
  return classname.replace('/','.');
}
Program: 25711
Project: 25711
Buggy source:
/** 
 * Returns the <code>CtClass</code> object representing the type specified by the cast.
 */
public CtClass getType() throws NotFoundException {
  ConstPool cp=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  String name=cp.getClassInfo(index);
  return Descriptor.toCtClass(name,thisClass.getClassPool());
}

Fixed version (ground truth):
/** 
 * Returns the <code>CtClass</code> object representing the type specified by the cast.
 */
public CtClass getType() throws NotFoundException {
  ConstPool cp=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  String name=cp.getClassInfo(index);
  return thisClass.getClassPool().getCtClass(name);
}
Program: 25712
Project: 25712
Buggy source:
/** 
 * Returns the type handled by the catch clause.
 */
public CtClass getType() throws NotFoundException {
  ConstPool cp=getConstPool();
  String name=cp.getClassInfo(etable.catchType(index));
  return Descriptor.toCtClass(name,thisClass.getClassPool());
}

Fixed version (ground truth):
/** 
 * Returns the type handled by the catch clause.
 */
public CtClass getType() throws NotFoundException {
  ConstPool cp=getConstPool();
  String name=cp.getClassInfo(etable.catchType(index));
  return thisClass.getClassPool().getCtClass(name);
}
Program: 25713
Project: 25713
Buggy source:
/** 
 * Returns the <code>CtClass</code> object representing the type name on the right hand side of the instanceof operator.
 */
public CtClass getType() throws NotFoundException {
  ConstPool cp=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  String name=cp.getClassInfo(index);
  return Descriptor.toCtClass(name,thisClass.getClassPool());
}

Fixed version (ground truth):
/** 
 * Returns the <code>CtClass</code> object representing the type name on the right hand side of the instanceof operator.
 */
public CtClass getType() throws NotFoundException {
  ConstPool cp=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  String name=cp.getClassInfo(index);
  return thisClass.getClassPool().getCtClass(name);
}
Program: 25714
Project: 25714
Buggy source:
CtNewClass(String name,ClassPool cp,boolean isInterface,CtClass superclass){
  super(name,cp);
  wasChanged=true;
  String superName;
  if (superclass == null)   superName=null;
 else   superName=superclass.getName();
  classfile=new ClassFile(isInterface,name,superName);
  setModifiers(Modifier.setPublic(getModifiers()));
  hasConstructor=isInterface;
}

Fixed version (ground truth):
CtNewClass(String name,ClassPool cp,boolean isInterface,CtClass superclass){
  super(name,cp);
  wasChanged=true;
  String superName;
  if (isInterface || superclass == null)   superName=null;
 else   superName=superclass.getName();
  classfile=new ClassFile(isInterface,name,superName);
  if (isInterface && superclass != null)   classfile.setInterfaces(new String[]{superclass.getName()});
  setModifiers(Modifier.setPublic(getModifiers()));
  hasConstructor=isInterface;
}
Program: 25715
Project: 25715
Buggy source:
private static LdcEntry copyCode(byte[] code,int beginPos,int endPos,ConstPool srcCp,byte[] newcode,ConstPool destCp,Map classnameMap) throws BadBytecode {
  int i2, index;
  LdcEntry ldcEntry=null;
  for (int i=beginPos; i < endPos; i=i2) {
    i2=CodeIterator.nextOpcode(code,i);
    byte c=code[i];
    newcode[i]=c;
switch (c & 0xff) {
case LDC_W:
case LDC2_W:
case GETSTATIC:
case PUTSTATIC:
case GETFIELD:
case PUTFIELD:
case INVOKEVIRTUAL:
case INVOKESPECIAL:
case INVOKESTATIC:
case NEW:
case ANEWARRAY:
case CHECKCAST:
case INSTANCEOF:
      copyConstPoolInfo(i + 1,code,srcCp,newcode,destCp,classnameMap);
    break;
case LDC:
  index=code[i + 1] & 0xff;
index=srcCp.copy(index,destCp,classnameMap);
if (index < 0x100) newcode[i + 1]=(byte)index;
 else {
LdcEntry ldc=new LdcEntry();
ldc.where=i;
ldc.index=index;
ldc.next=ldcEntry;
ldcEntry=ldc;
}
break;
case INVOKEINTERFACE:
copyConstPoolInfo(i + 1,code,srcCp,newcode,destCp,classnameMap);
newcode[i + 3]=code[i + 3];
newcode[i + 4]=code[i + 4];
break;
case MULTIANEWARRAY:
copyConstPoolInfo(i + 1,code,srcCp,newcode,destCp,classnameMap);
newcode[i + 3]=code[i + 3];
break;
default :
while (++i < i2) newcode[i]=code[i];
break;
}
}
return ldcEntry;
}

Fixed version (ground truth):
private static LdcEntry copyCode(byte[] code,int beginPos,int endPos,ConstPool srcCp,byte[] newcode,ConstPool destCp,Map classnameMap) throws BadBytecode {
  int i2, index;
  LdcEntry ldcEntry=null;
  for (int i=beginPos; i < endPos; i=i2) {
    i2=CodeIterator.nextOpcode(code,i);
    byte c=code[i];
    newcode[i]=c;
switch (c & 0xff) {
case LDC_W:
case LDC2_W:
case GETSTATIC:
case PUTSTATIC:
case GETFIELD:
case PUTFIELD:
case INVOKEVIRTUAL:
case INVOKESPECIAL:
case INVOKESTATIC:
case NEW:
case ANEWARRAY:
case CHECKCAST:
case INSTANCEOF:
      copyConstPoolInfo(i + 1,code,srcCp,newcode,destCp,classnameMap);
    break;
case LDC:
  index=code[i + 1] & 0xff;
index=srcCp.copy(index,destCp,classnameMap);
if (index < 0x100) newcode[i + 1]=(byte)index;
 else {
newcode[i]=NOP;
newcode[i + 1]=NOP;
LdcEntry ldc=new LdcEntry();
ldc.where=i;
ldc.index=index;
ldc.next=ldcEntry;
ldcEntry=ldc;
}
break;
case INVOKEINTERFACE:
copyConstPoolInfo(i + 1,code,srcCp,newcode,destCp,classnameMap);
newcode[i + 3]=code[i + 3];
newcode[i + 4]=code[i + 4];
break;
case MULTIANEWARRAY:
copyConstPoolInfo(i + 1,code,srcCp,newcode,destCp,classnameMap);
newcode[i + 3]=code[i + 3];
break;
default :
while (++i < i2) newcode[i]=code[i];
break;
}
}
return ldcEntry;
}
Program: 25716
Project: 25716
Buggy source:
/** 
 * Replaces the explicit cast operator with the bytecode derived from the given source text. <p>$0 is available but the value is <code>null</code>.
 * @param statement         a Java statement.
 */
public void replace(String statement) throws CannotCompileException {
  ConstPool constPool=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  Javac jc=new Javac(thisClass);
  ClassPool cp=thisClass.getClassPool();
  CodeAttribute ca=iterator.get();
  try {
    CtClass[] params=new CtClass[]{cp.get(javaLangObject)};
    CtClass retType=getType();
    int paramVar=ca.getMaxLocals();
    jc.recordParams(javaLangObject,params,true,paramVar,withinStatic());
    int retVar=jc.recordReturnType(retType,true);
    jc.recordProceed(new ProceedForCast(index,retType));
    checkResultValue(retType,statement);
    Bytecode bytecode=jc.getBytecode();
    storeStack(params,true,paramVar,bytecode);
    jc.recordLocalVariables(ca,pos);
    bytecode.addConstZero(retType);
    bytecode.addStore(retVar,retType);
    jc.compileStmnt(statement);
    bytecode.addLoad(retVar,retType);
    replace0(pos,bytecode,3);
  }
 catch (  CompileError e) {
    throw new CannotCompileException(e);
  }
catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
catch (  BadBytecode e) {
    throw new CannotCompileException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Replaces the explicit cast operator with the bytecode derived from the given source text. <p>$0 is available but the value is <code>null</code>.
 * @param statement         a Java statement.
 */
public void replace(String statement) throws CannotCompileException {
  thisClass.getClassFile();
  ConstPool constPool=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  Javac jc=new Javac(thisClass);
  ClassPool cp=thisClass.getClassPool();
  CodeAttribute ca=iterator.get();
  try {
    CtClass[] params=new CtClass[]{cp.get(javaLangObject)};
    CtClass retType=getType();
    int paramVar=ca.getMaxLocals();
    jc.recordParams(javaLangObject,params,true,paramVar,withinStatic());
    int retVar=jc.recordReturnType(retType,true);
    jc.recordProceed(new ProceedForCast(index,retType));
    checkResultValue(retType,statement);
    Bytecode bytecode=jc.getBytecode();
    storeStack(params,true,paramVar,bytecode);
    jc.recordLocalVariables(ca,pos);
    bytecode.addConstZero(retType);
    bytecode.addStore(retVar,retType);
    jc.compileStmnt(statement);
    bytecode.addLoad(retVar,retType);
    replace0(pos,bytecode,3);
  }
 catch (  CompileError e) {
    throw new CannotCompileException(e);
  }
catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
catch (  BadBytecode e) {
    throw new CannotCompileException("String_Node_Str");
  }
}
Program: 25718
Project: 25718
Buggy source:
/** 
 * Replaces the instanceof operator with the bytecode derived from the given source text. <p>$0 is available but the value is <code>null</code>.
 * @param statement         a Java statement.
 */
public void replace(String statement) throws CannotCompileException {
  ConstPool constPool=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  Javac jc=new Javac(thisClass);
  ClassPool cp=thisClass.getClassPool();
  CodeAttribute ca=iterator.get();
  try {
    CtClass[] params=new CtClass[]{cp.get(javaLangObject)};
    CtClass retType=CtClass.booleanType;
    int paramVar=ca.getMaxLocals();
    jc.recordParams(javaLangObject,params,true,paramVar,withinStatic());
    int retVar=jc.recordReturnType(retType,true);
    jc.recordProceed(new ProceedForInstanceof(index));
    jc.recordType(getType());
    checkResultValue(retType,statement);
    Bytecode bytecode=jc.getBytecode();
    storeStack(params,true,paramVar,bytecode);
    jc.recordLocalVariables(ca,pos);
    bytecode.addConstZero(retType);
    bytecode.addStore(retVar,retType);
    jc.compileStmnt(statement);
    bytecode.addLoad(retVar,retType);
    replace0(pos,bytecode,3);
  }
 catch (  CompileError e) {
    throw new CannotCompileException(e);
  }
catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
catch (  BadBytecode e) {
    throw new CannotCompileException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Replaces the instanceof operator with the bytecode derived from the given source text. <p>$0 is available but the value is <code>null</code>.
 * @param statement         a Java statement.
 */
public void replace(String statement) throws CannotCompileException {
  thisClass.getClassFile();
  ConstPool constPool=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  Javac jc=new Javac(thisClass);
  ClassPool cp=thisClass.getClassPool();
  CodeAttribute ca=iterator.get();
  try {
    CtClass[] params=new CtClass[]{cp.get(javaLangObject)};
    CtClass retType=CtClass.booleanType;
    int paramVar=ca.getMaxLocals();
    jc.recordParams(javaLangObject,params,true,paramVar,withinStatic());
    int retVar=jc.recordReturnType(retType,true);
    jc.recordProceed(new ProceedForInstanceof(index));
    jc.recordType(getType());
    checkResultValue(retType,statement);
    Bytecode bytecode=jc.getBytecode();
    storeStack(params,true,paramVar,bytecode);
    jc.recordLocalVariables(ca,pos);
    bytecode.addConstZero(retType);
    bytecode.addStore(retVar,retType);
    jc.compileStmnt(statement);
    bytecode.addLoad(retVar,retType);
    replace0(pos,bytecode,3);
  }
 catch (  CompileError e) {
    throw new CannotCompileException(e);
  }
catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
catch (  BadBytecode e) {
    throw new CannotCompileException("String_Node_Str");
  }
}
Program: 25722
Project: 25722
Buggy source:
/** 
 * Changes a super class unless this object represents an interface. The new super class must be compatible with the old one; for example, it should inherit from the old super class. <p>If this object represents an interface, this method is equivalent to <code>addInterface()</code>; it appends <code>clazz</code> to the list of the super interfaces extended by that interface. Note that an interface can extend multiple super interfaces.
 */
public void setSuperclass(CtClass clazz) throws CannotCompileException {
  checkModify();
}

Fixed version (ground truth):
/** 
 * Changes a super class unless this object represents an interface. The new super class must be compatible with the old one; for example, it should inherit from the old super class. <p>If this object represents an interface, this method is equivalent to <code>addInterface()</code>; it appends <code>clazz</code> to the list of the super interfaces extended by that interface. Note that an interface can extend multiple super interfaces.
 * @see #replaceClassName(String,String)
 * @see #replaceClassName(ClassMap)
 */
public void setSuperclass(CtClass clazz) throws CannotCompileException {
  checkModify();
}
Program: 25723
Project: 25723
Buggy source:
void remove(CtMember mem){
  CtMember m=this;
  CtMember node;
  while ((node=m.next) != this) {
    if (node == mem) {
      m.next=node.next;
      if (node == methodTail)       methodTail=m;
 else       if (node == consTail)       consTail=m;
 else       if (node == fieldTail)       fieldTail=m;
      break;
    }
 else     m=m.next;
  }
}

Fixed version (ground truth):
void remove(CtMember mem){
  CtMember m=this;
  CtMember node;
  while ((node=m.next) != this) {
    if (node == mem) {
      m.next=node.next;
      if (node == methodTail)       methodTail=m;
      if (node == consTail)       consTail=m;
      if (node == fieldTail)       fieldTail=m;
      break;
    }
 else     m=m.next;
  }
}
Program: 25724
Project: 25724
Buggy source:
/** 
 * Compiles the given source code and creates a method. This method simply delegates to <code>make()</code> in <code>CtNewMethod</code>.  See it for more details. <code>CtNewMethod</code> has a number of useful factory methods.
 * @param src               the source text. 
 * @param declaring    the class to which the created method is added.
 * @see CtNewMethod#make(String,CtClass)
 */
public static CtMethod make(String src,CtClass declaring) throws CannotCompileException {
  return CtNewMethod.make(src,declaring);
}

Fixed version (ground truth):
/** 
 * Creates a method from a <code>MethodInfo</code> object.
 * @param declaring     the class declaring the method.
 * @throws CannotCompileException       if the the <code>MethodInfo</code>object and the declaring class have different <code>ConstPool</code> objects
 * @since 3.6
 */
public static CtMethod make(MethodInfo minfo,CtClass declaring) throws CannotCompileException {
  if (declaring.getClassFile2().getConstPool() != minfo.getConstPool())   throw new CannotCompileException("String_Node_Str");
  return new CtMethod(minfo,declaring);
}
Program: 25725
Project: 25725
Buggy source:
private boolean hasChanged(TypedBlock[] blocks){
  int n=blocks.length;
  boolean changed=false;
  for (int i=0; i < n; i++) {
    TypedBlock tb=blocks[i];
    if (tb.status == DONE)     tb.status=NOT_YET;
 else {
      tb.status=CHANGED_LAST;
      changed=true;
    }
  }
  return changed;
}

Fixed version (ground truth):
private boolean hasChanged(TypedBlock[] blocks){
  int n=blocks.length;
  boolean changed=false;
  for (int i=0; i < n; i++) {
    TypedBlock tb=blocks[i];
    if (tb.status == CHANGED_NOW) {
      tb.status=CHANGED_LAST;
      changed=true;
    }
 else     tb.status=NOT_YET;
  }
  return changed;
}
Program: 25728
Project: 25728
Buggy source:
private boolean update(ClassPool cp,String oldName,String typeName) throws BadBytecode {
  if (typeName == null)   return false;
 else   if (oldName == null)   return true;
 else   if (oldName.equals(typeName))   return false;
  try {
    if (cache == null)     cache=cp.get(oldName);
    CtClass cache2=cp.get(typeName);
    if (cache2.subtypeOf(cache)) {
      cache=cache2;
      return true;
    }
 else     return false;
  }
 catch (  NotFoundException e) {
    throw new BadBytecode("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
private boolean update(ClassPool cp,String oldName,String typeName) throws BadBytecode {
  if (typeName == null)   return false;
 else   if (oldName == null)   return true;
 else   if (oldName.equals(typeName))   return false;
 else   if (typeName.charAt(0) == '[' && oldName.equals("String_Node_Str")) {
    return true;
  }
  try {
    if (cache == null)     cache=cp.get(oldName);
    CtClass cache2=cp.get(typeName);
    if (cache2.subtypeOf(cache)) {
      cache=cache2;
      return true;
    }
 else     return false;
  }
 catch (  NotFoundException e) {
    throw new BadBytecode("String_Node_Str" + e.getMessage());
  }
}
Program: 25729
Project: 25729
Buggy source:
public ClassFile getClassFile2(){
  ClassFile cfile=classfile;
  if (cfile != null)   return cfile;
  if (readCounter++ > READ_THRESHOLD) {
    getCounter+=2;
    releaseClassFiles();
    readCounter=0;
  }
  if (rawClassfile != null) {
    try {
      classfile=new ClassFile(new DataInputStream(new ByteArrayInputStream(rawClassfile)));
      rawClassfile=null;
      getCounter=GET_THRESHOLD;
      return classfile;
    }
 catch (    IOException e) {
      throw new RuntimeException(e.toString(),e);
    }
  }
  InputStream fin=null;
  try {
    fin=classPool.openClassfile(getName());
    if (fin == null)     throw new NotFoundException(getName());
    fin=new BufferedInputStream(fin);
    ClassFile cf=new ClassFile(new DataInputStream(fin));
    if (!cf.getName().equals(qualifiedName))     throw new RuntimeException("String_Node_Str" + qualifiedName + "String_Node_Str"+ cf.getName()+ "String_Node_Str"+ qualifiedName.replace('.','/')+ "String_Node_Str");
    classfile=cf;
    return cf;
  }
 catch (  NotFoundException e) {
    throw new RuntimeException(e.toString(),e);
  }
catch (  IOException e) {
    throw new RuntimeException(e.toString(),e);
  }
 finally {
    if (fin != null)     try {
      fin.close();
    }
 catch (    IOException e) {
    }
  }
}

Fixed version (ground truth):
public ClassFile getClassFile2(){
  ClassFile cfile=classfile;
  if (cfile != null)   return cfile;
  if (readCounter++ > READ_THRESHOLD) {
    releaseClassFiles();
    readCounter=0;
  }
  if (rawClassfile != null) {
    try {
      classfile=new ClassFile(new DataInputStream(new ByteArrayInputStream(rawClassfile)));
      rawClassfile=null;
      getCounter=GET_THRESHOLD;
      return classfile;
    }
 catch (    IOException e) {
      throw new RuntimeException(e.toString(),e);
    }
  }
  InputStream fin=null;
  try {
    fin=classPool.openClassfile(getName());
    if (fin == null)     throw new NotFoundException(getName());
    fin=new BufferedInputStream(fin);
    ClassFile cf=new ClassFile(new DataInputStream(fin));
    if (!cf.getName().equals(qualifiedName))     throw new RuntimeException("String_Node_Str" + qualifiedName + "String_Node_Str"+ cf.getName()+ "String_Node_Str"+ qualifiedName.replace('.','/')+ "String_Node_Str");
    classfile=cf;
    return cf;
  }
 catch (  NotFoundException e) {
    throw new RuntimeException(e.toString(),e);
  }
catch (  IOException e) {
    throw new RuntimeException(e.toString(),e);
  }
 finally {
    if (fin != null)     try {
      fin.close();
    }
 catch (    IOException e) {
    }
  }
}