Program: 165362
Project: 165362
Buggy source:
public Vector<App> getApps(String appid,String filter,boolean update,boolean exclusions){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mContext);
  boolean pref_antiAds=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiTracking=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiNonFreeAdd=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiNonFreeNet=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiNonFreeDep=prefs.getBoolean("String_Node_Str",false);
  boolean pref_showIncompat=prefs.getBoolean("String_Node_Str",false);
  boolean pref_rooted=prefs.getBoolean("String_Node_Str",true);
  Vector<App> result=new Vector<App>();
  Cursor c=null;
  Cursor c2=null;
  try {
    String query="String_Node_Str" + TABLE_APP;
    if (appid != null) {
      query+="String_Node_Str" + appid + "String_Node_Str";
    }
 else     if (filter != null) {
      query+="String_Node_Str" + filter + "String_Node_Str"+ "String_Node_Str"+ filter+ "String_Node_Str";
    }
    query+="String_Node_Str";
    c=db.rawQuery(query,null);
    c.moveToFirst();
    while (!c.isAfterLast()) {
      App app=new App();
      app.antiFeatures=DB.CommaSeparatedList.make(c.getString(c.getColumnIndex("String_Node_Str")));
      boolean include=true;
      if (app.antiFeatures != null && exclusions) {
        for (        String af : app.antiFeatures) {
          if (af.equals("String_Node_Str") && !pref_antiAds)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiTracking)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiNonFreeNet)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiNonFreeAdd)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiNonFreeDep)           include=false;
        }
      }
      app.requirements=DB.CommaSeparatedList.make(c.getString(c.getColumnIndex("String_Node_Str")));
      if (app.requirements != null && exclusions) {
        for (        String r : app.requirements) {
          if (r.equals("String_Node_Str") && !pref_rooted) {
            include=false;
          }
        }
      }
      if (include) {
        app.id=c.getString(c.getColumnIndex("String_Node_Str"));
        app.name=c.getString(c.getColumnIndex("String_Node_Str"));
        app.summary=c.getString(c.getColumnIndex("String_Node_Str"));
        app.icon=c.getString(c.getColumnIndex("String_Node_Str"));
        app.description=c.getString(c.getColumnIndex("String_Node_Str"));
        app.license=c.getString(c.getColumnIndex("String_Node_Str"));
        app.category=c.getString(c.getColumnIndex("String_Node_Str"));
        app.webURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.trackerURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.sourceURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.donateURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.installedVersion=c.getString(c.getColumnIndex("String_Node_Str"));
        app.installedVerCode=c.getInt(c.getColumnIndex("String_Node_Str"));
        app.marketVersion=c.getString(c.getColumnIndex("String_Node_Str"));
        app.marketVercode=c.getInt(c.getColumnIndex("String_Node_Str"));
        String sAdded=c.getString(c.getColumnIndex("String_Node_Str"));
        app.added=sAdded.length() == 0 ? null : mDateFormat.parse(sAdded);
        String sLastUpdated=c.getString(c.getColumnIndex("String_Node_Str"));
        app.lastUpdated=sLastUpdated.length() == 0 ? null : mDateFormat.parse(sLastUpdated);
        app.hasUpdates=false;
        c2=db.rawQuery("String_Node_Str" + TABLE_APK + "String_Node_Str",new String[]{app.id});
        c2.moveToFirst();
        boolean compatible=pref_showIncompat || !exclusions;
        while (!c2.isAfterLast()) {
          Apk apk=new Apk();
          apk.id=app.id;
          apk.version=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.vercode=c2.getInt(c2.getColumnIndex("String_Node_Str"));
          apk.server=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.hash=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.hashType=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.sig=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.srcname=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.size=c2.getInt(c2.getColumnIndex("String_Node_Str"));
          apk.apkName=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.apkSource=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.minSdkVersion=c2.getInt(c2.getColumnIndex("String_Node_Str"));
          String sApkAdded=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.added=sApkAdded.length() == 0 ? null : mDateFormat.parse(sApkAdded);
          apk.permissions=CommaSeparatedList.make(c2.getString(c2.getColumnIndex("String_Node_Str")));
          apk.features=CommaSeparatedList.make(c2.getString(c2.getColumnIndex("String_Node_Str")));
          app.apks.add(apk);
          if (!compatible && compatChecker.isCompatible(apk)) {
            compatible=true;
          }
          c2.moveToNext();
        }
        c2.close();
        if (compatible) {
          result.add(app);
        }
 else {
          Log.d("String_Node_Str","String_Node_Str" + app.id);
        }
      }
      c.moveToNext();
    }
  }
 catch (  Exception e) {
    Log.e("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
  }
 finally {
    if (c != null) {
      c.close();
    }
    if (c2 != null) {
      c2.close();
    }
  }
  if (update) {
    db.beginTransaction();
    try {
      getUpdates(result);
      db.setTransactionSuccessful();
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
    }
 finally {
      db.endTransaction();
    }
  }
  for (  App app : result) {
    Apk curver=app.getCurrentVersion(compatChecker);
    if (curver != null && app.installedVersion != null && !app.installedVersion.equals(curver.version)) {
      if (app.installedVerCode < curver.vercode) {
        app.hasUpdates=true;
        app.currentVersion=curver.version;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
public Vector<App> getApps(String appid,String filter,boolean update,boolean exclusions){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mContext);
  boolean pref_antiAds=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiTracking=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiNonFreeAdd=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiNonFreeNet=prefs.getBoolean("String_Node_Str",false);
  boolean pref_antiNonFreeDep=prefs.getBoolean("String_Node_Str",false);
  boolean pref_showIncompat=prefs.getBoolean("String_Node_Str",false);
  boolean pref_rooted=prefs.getBoolean("String_Node_Str",true);
  Vector<App> result=new Vector<App>();
  Cursor c=null;
  Cursor c2=null;
  try {
    String query="String_Node_Str" + TABLE_APP;
    if (appid != null) {
      query+="String_Node_Str" + appid + "String_Node_Str";
    }
 else     if (filter != null) {
      query+="String_Node_Str" + filter + "String_Node_Str"+ "String_Node_Str"+ filter+ "String_Node_Str";
    }
    query+="String_Node_Str";
    c=db.rawQuery(query,null);
    c.moveToFirst();
    while (!c.isAfterLast()) {
      App app=new App();
      app.antiFeatures=DB.CommaSeparatedList.make(c.getString(c.getColumnIndex("String_Node_Str")));
      boolean include=true;
      if (app.antiFeatures != null && exclusions) {
        for (        String af : app.antiFeatures) {
          if (af.equals("String_Node_Str") && !pref_antiAds)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiTracking)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiNonFreeNet)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiNonFreeAdd)           include=false;
 else           if (af.equals("String_Node_Str") && !pref_antiNonFreeDep)           include=false;
        }
      }
      app.requirements=DB.CommaSeparatedList.make(c.getString(c.getColumnIndex("String_Node_Str")));
      if (app.requirements != null && exclusions) {
        for (        String r : app.requirements) {
          if (r.equals("String_Node_Str") && !pref_rooted) {
            include=false;
          }
        }
      }
      if (include) {
        app.id=c.getString(c.getColumnIndex("String_Node_Str"));
        app.name=c.getString(c.getColumnIndex("String_Node_Str"));
        app.summary=c.getString(c.getColumnIndex("String_Node_Str"));
        app.icon=c.getString(c.getColumnIndex("String_Node_Str"));
        app.description=c.getString(c.getColumnIndex("String_Node_Str"));
        app.license=c.getString(c.getColumnIndex("String_Node_Str"));
        app.category=c.getString(c.getColumnIndex("String_Node_Str"));
        app.webURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.trackerURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.sourceURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.donateURL=c.getString(c.getColumnIndex("String_Node_Str"));
        app.installedVersion=c.getString(c.getColumnIndex("String_Node_Str"));
        app.installedVerCode=c.getInt(c.getColumnIndex("String_Node_Str"));
        app.marketVersion=c.getString(c.getColumnIndex("String_Node_Str"));
        app.marketVercode=c.getInt(c.getColumnIndex("String_Node_Str"));
        String sAdded=c.getString(c.getColumnIndex("String_Node_Str"));
        app.added=(sAdded == null || sAdded.length() == 0) ? null : mDateFormat.parse(sAdded);
        String sLastUpdated=c.getString(c.getColumnIndex("String_Node_Str"));
        app.lastUpdated=(sLastUpdated == null || sLastUpdated.length() == 0) ? null : mDateFormat.parse(sLastUpdated);
        app.hasUpdates=false;
        c2=db.rawQuery("String_Node_Str" + TABLE_APK + "String_Node_Str",new String[]{app.id});
        c2.moveToFirst();
        boolean compatible=pref_showIncompat || !exclusions;
        while (!c2.isAfterLast()) {
          Apk apk=new Apk();
          apk.id=app.id;
          apk.version=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.vercode=c2.getInt(c2.getColumnIndex("String_Node_Str"));
          apk.server=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.hash=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.hashType=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.sig=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.srcname=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.size=c2.getInt(c2.getColumnIndex("String_Node_Str"));
          apk.apkName=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.apkSource=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.minSdkVersion=c2.getInt(c2.getColumnIndex("String_Node_Str"));
          String sApkAdded=c2.getString(c2.getColumnIndex("String_Node_Str"));
          apk.added=(sApkAdded == null || sApkAdded.length() == 0) ? null : mDateFormat.parse(sApkAdded);
          apk.permissions=CommaSeparatedList.make(c2.getString(c2.getColumnIndex("String_Node_Str")));
          apk.features=CommaSeparatedList.make(c2.getString(c2.getColumnIndex("String_Node_Str")));
          app.apks.add(apk);
          if (!compatible && compatChecker.isCompatible(apk)) {
            compatible=true;
          }
          c2.moveToNext();
        }
        c2.close();
        if (compatible) {
          result.add(app);
        }
 else {
          Log.d("String_Node_Str","String_Node_Str" + app.id);
        }
      }
      c.moveToNext();
    }
  }
 catch (  Exception e) {
    Log.e("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
  }
 finally {
    if (c != null) {
      c.close();
    }
    if (c2 != null) {
      c2.close();
    }
  }
  if (update) {
    db.beginTransaction();
    try {
      getUpdates(result);
      db.setTransactionSuccessful();
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
    }
 finally {
      db.endTransaction();
    }
  }
  for (  App app : result) {
    Apk curver=app.getCurrentVersion(compatChecker);
    if (curver != null && app.installedVersion != null && !app.installedVersion.equals(curver.version)) {
      if (app.installedVerCode < curver.vercode) {
        app.hasUpdates=true;
        app.currentVersion=curver.version;
      }
    }
  }
  return result;
}