nus-yam/ex-repair huggingface dataset:
Program: 165193
Project: 165193
Buggy source:
@Override public int compare(Class<?> o1,Class<?> o2){
  Changelog c1=o1.getAnnotation(Changelog.class);
  Changelog c2=o2.getAnnotation(Changelog.class);
  String val1=isBlank(c1.order()) ? o1.getCanonicalName() : c1.order();
  String val2=isBlank(c2.order()) ? o2.getCanonicalName() : c2.order();
  return val1.compareTo(val2);
}

Fixed version (ground truth):
@Override public int compare(Class<?> o1,Class<?> o2){
  Changelog c1=o1.getAnnotation(Changelog.class);
  Changelog c2=o2.getAnnotation(Changelog.class);
  String val1=isBlank(c1.order()) ? o1.getCanonicalName() : c1.order();
  String val2=isBlank(c2.order()) ? o2.getCanonicalName() : c2.order();
  if (val1 == null && val2 == null) {
    return 0;
  }
 else   if (val1 == null) {
    return -1;
  }
 else   if (val2 == null) {
    return 1;
  }
  return val1.compareTo(val2);
}
Program: 165194
Project: 165194
Buggy source:
public static Set<Class<?>> fetchChangelogsAt(String changelogsBasePackage){
  Reflections reflections=new Reflections(changelogsBasePackage);
  Set<Class<?>> annotated=reflections.getTypesAnnotatedWith(Changelog.class);
  return annotated;
}

Fixed version (ground truth):
public static List<Class<?>> fetchChangelogsAt(String changelogsBasePackage){
  Reflections reflections=new Reflections(changelogsBasePackage);
  Set<Class<?>> annotated=reflections.getTypesAnnotatedWith(Changelog.class);
  List<Class<?>> annotatedSorted=new ArrayList<>(annotated);
  Collections.sort(annotatedSorted,new Comparator<Class<?>>(){
    @Override public int compare(    Class<?> o1,    Class<?> o2){
      Changelog c1=o1.getAnnotation(Changelog.class);
      Changelog c2=o2.getAnnotation(Changelog.class);
      String val1=StringUtils.isEmpty(c1.order()) ? o1.getCanonicalName() : c1.order();
      String val2=StringUtils.isEmpty(c2.order()) ? o2.getCanonicalName() : c2.order();
      return val1.compareTo(val2);
    }
  }
);
  return annotatedSorted;
}
Program: 165195
Project: 165195
Buggy source:
public static List<Method> fetchChangesetsAt(final Class<?> type){
  final List<Method> methods=new ArrayList<>();
  final List<Method> allMethods=new ArrayList<>(Arrays.asList(type.getDeclaredMethods()));
  for (  final Method method : allMethods) {
    if (method.isAnnotationPresent(Changeset.class)) {
      methods.add(method);
    }
  }
  return methods;
}

Fixed version (ground truth):
public static List<Method> fetchChangesetsAt(final Class<?> type){
  final List<Method> methods=new ArrayList<>();
  final List<Method> allMethods=new ArrayList<>(Arrays.asList(type.getDeclaredMethods()));
  for (  final Method method : allMethods) {
    if (method.isAnnotationPresent(Changeset.class)) {
      methods.add(method);
    }
  }
  Collections.sort(methods,new Comparator<Method>(){
    @Override public int compare(    Method o1,    Method o2){
      Changeset c1=o1.getAnnotation(Changeset.class);
      Changeset c2=o2.getAnnotation(Changeset.class);
      return c1.order().compareTo(c2.order());
    }
  }
);
  return methods;
}
Program: 165196
Project: 165196
Buggy source:
@Before public void initRunner(){
  runner=new Mongobee();
  runner.setDbName("String_Node_Str");
  runner.setHost("String_Node_Str");
  runner.setEnabled(true);
  runner.setChangelogsBasePackage(MongobeeUtilsTestResource.class.getPackage().getName());
}

Fixed version (ground truth):
@Before public void initRunner(){
  runner=new Mongobee();
  runner.setDbName("String_Node_Str");
  runner.setHost("String_Node_Str");
  runner.setEnabled(true);
  runner.setChangelogsBasePackage(MongobeeTestResource.class.getPackage().getName());
}
Program: 165197
Project: 165197
Buggy source:
@Test public void shouldFindChangesetMethods(){
  List<Method> foundMethods=fetchChangesetsAt(MongobeeUtilsTestResource.class);
  Assert.assertTrue(foundMethods != null && foundMethods.size() == 2);
}

Fixed version (ground truth):
@Test public void shouldFindChangesetMethods(){
  List<Method> foundMethods=fetchChangesetsAt(MongobeeTestResource.class);
  Assert.assertTrue(foundMethods != null && foundMethods.size() == 4);
}
Program: 165198
Project: 165198
Buggy source:
@Test public void shouldFindChangelogClasses(){
  String scanPackage=MongobeeUtilsTestResource.class.getPackage().getName();
  Set<Class<?>> foundClasses=fetchChangelogsAt(scanPackage);
  Assert.assertTrue(foundClasses != null && foundClasses.size() > 0);
}

Fixed version (ground truth):
@Test public void shouldFindChangelogClasses(){
  String scanPackage=MongobeeTestResource.class.getPackage().getName();
  List<Class<?>> foundClasses=fetchChangelogsAt(scanPackage);
  Assert.assertTrue(foundClasses != null && foundClasses.size() > 0);
}
Program: 165199
Project: 165199
Buggy source:
@Test public void shouldCreateEntry(){
  List<Method> foundMethods=fetchChangesetsAt(MongobeeUtilsTestResource.class);
  for (  Method foundMethod : foundMethods) {
    ChangeEntry entry=MongobeeAnnotationUtils.createChangeEntryFor(foundMethod);
    Assert.assertEquals("String_Node_Str",entry.getAuthor());
    Assert.assertEquals(MongobeeUtilsTestResource.class.getName(),entry.getChangelogClass());
    Assert.assertNotNull(entry.getTimestamp());
    Assert.assertNotNull(entry.getChangeId());
    Assert.assertNotNull(entry.getChangesetMethodName());
  }
}

Fixed version (ground truth):
@Test public void shouldCreateEntry(){
  List<Method> foundMethods=fetchChangesetsAt(MongobeeTestResource.class);
  for (  Method foundMethod : foundMethods) {
    ChangeEntry entry=MongobeeAnnotationUtils.createChangeEntryFor(foundMethod);
    Assert.assertEquals("String_Node_Str",entry.getAuthor());
    Assert.assertEquals(MongobeeTestResource.class.getName(),entry.getChangelogClass());
    Assert.assertNotNull(entry.getTimestamp());
    Assert.assertNotNull(entry.getChangeId());
    Assert.assertNotNull(entry.getChangesetMethodName());
  }
}
Program: 165201
Project: 165201
Buggy source:
public SigningException(String message){
  super("String_Node_Str" + message);
}

Fixed version (ground truth):
public SigningException(Repo repo,String message){
  super((repo == null ? "String_Node_Str" : repo.name) + "String_Node_Str" + message);
}
Program: 165202
Project: 165202
Buggy source:
/** 
 * A new repo can be added with or without the fingerprint of the signing certificate.  If no fingerprint is supplied, then do a pure TOFU and just store the certificate as valid.  If there is a fingerprint, then first check that the signing certificate in the jar matches that fingerprint.
 */
private void verifyAndStoreTOFUCerts(String certFromIndexXml,X509Certificate rawCertFromJar) throws SigningException {
  if (repo.signingCertificate != null) {
    return;
  }
  if (repo.fingerprint != null) {
    String fingerprintFromIndexXml=Utils.calcFingerprint(certFromIndexXml);
    String fingerprintFromJar=Utils.calcFingerprint(rawCertFromJar);
    if (!repo.fingerprint.equalsIgnoreCase(fingerprintFromIndexXml) || !repo.fingerprint.equalsIgnoreCase(fingerprintFromJar)) {
      throw new SigningException("String_Node_Str");
    }
  }
  Utils.debugLog(TAG,"String_Node_Str" + repo.address);
  ContentValues values=new ContentValues(2);
  values.put(RepoTable.Cols.LAST_UPDATED,Utils.formatDate(new Date(),"String_Node_Str"));
  values.put(RepoTable.Cols.SIGNING_CERT,Hasher.hex(rawCertFromJar));
  RepoProvider.Helper.update(context,repo,values);
}

Fixed version (ground truth):
/** 
 * A new repo can be added with or without the fingerprint of the signing certificate.  If no fingerprint is supplied, then do a pure TOFU and just store the certificate as valid.  If there is a fingerprint, then first check that the signing certificate in the jar matches that fingerprint.
 */
private void verifyAndStoreTOFUCerts(String certFromIndexXml,X509Certificate rawCertFromJar) throws SigningException {
  if (repo.signingCertificate != null) {
    return;
  }
  if (repo.fingerprint != null) {
    String fingerprintFromIndexXml=Utils.calcFingerprint(certFromIndexXml);
    String fingerprintFromJar=Utils.calcFingerprint(rawCertFromJar);
    if (!repo.fingerprint.equalsIgnoreCase(fingerprintFromIndexXml) || !repo.fingerprint.equalsIgnoreCase(fingerprintFromJar)) {
      throw new SigningException(repo,"String_Node_Str");
    }
  }
  Utils.debugLog(TAG,"String_Node_Str" + repo.address);
  ContentValues values=new ContentValues(2);
  values.put(RepoTable.Cols.LAST_UPDATED,Utils.formatDate(new Date(),"String_Node_Str"));
  values.put(RepoTable.Cols.SIGNING_CERT,Hasher.hex(rawCertFromJar));
  RepoProvider.Helper.update(context,repo,values);
}
Program: 165203
Project: 165203
Buggy source:
/** 
 * FDroid works with three copies of the signing certificate: <li>in the downloaded jar</li> <li>in the index XML</li> <li>stored in the local database</li> It would work better removing the copy from the index XML, but it needs to stay there for backwards compatibility since the old TOFU process requires it.  Therefore, since all three have to be present, all three are compared.
 * @param certFromIndexXml the cert written into the header of the index XML
 * @param rawCertFromJar   the {@link X509Certificate} embedded in the downloaded jar
 */
private void verifyCerts(String certFromIndexXml,X509Certificate rawCertFromJar) throws SigningException {
  String certFromJar=Hasher.hex(rawCertFromJar);
  if (TextUtils.isEmpty(repo.signingCertificate) || TextUtils.isEmpty(certFromJar) || TextUtils.isEmpty(certFromIndexXml)) {
    throw new SigningException("String_Node_Str");
  }
  if (repo.signingCertificate.equals(certFromJar) && repo.signingCertificate.equals(certFromIndexXml) && certFromIndexXml.equals(certFromJar)) {
    return;
  }
  throw new SigningException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * FDroid works with three copies of the signing certificate: <li>in the downloaded jar</li> <li>in the index XML</li> <li>stored in the local database</li> It would work better removing the copy from the index XML, but it needs to stay there for backwards compatibility since the old TOFU process requires it.  Therefore, since all three have to be present, all three are compared.
 * @param certFromIndexXml the cert written into the header of the index XML
 * @param rawCertFromJar   the {@link X509Certificate} embedded in the downloaded jar
 */
private void verifyCerts(String certFromIndexXml,X509Certificate rawCertFromJar) throws SigningException {
  String certFromJar=Hasher.hex(rawCertFromJar);
  if (TextUtils.isEmpty(repo.signingCertificate) || TextUtils.isEmpty(certFromJar) || TextUtils.isEmpty(certFromIndexXml)) {
    throw new SigningException(repo,"String_Node_Str");
  }
  if (repo.signingCertificate.equals(certFromJar) && repo.signingCertificate.equals(certFromIndexXml) && certFromIndexXml.equals(certFromJar)) {
    return;
  }
  throw new SigningException(repo,"String_Node_Str");
}
Program: 165204
Project: 165204
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_delete:
    getContentResolver().delete(InstallHistoryService.LOG_URI,null,null);
  TextView textView=findViewById(R.id.text);
textView.setText("String_Node_Str");
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_share:
    StringBuilder stringBuilder=new StringBuilder();
  stringBuilder.append("String_Node_Str");
for (Repo repo : RepoProvider.Helper.all(this)) {
  if (repo.inuse) {
    stringBuilder.append("String_Node_Str");
    stringBuilder.append(repo.address);
    stringBuilder.append('\n');
  }
}
ShareCompat.IntentBuilder intentBuilder=ShareCompat.IntentBuilder.from(this).setStream(InstallHistoryService.LOG_URI).setSubject(getString(R.string.send_history_csv,getString(R.string.app_name))).setChooserTitle(R.string.send_install_history).setText(stringBuilder.toString()).setType("String_Node_Str");
Intent intent=intentBuilder.getIntent();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
break;
case R.id.menu_delete:
getContentResolver().delete(InstallHistoryService.LOG_URI,null,null);
TextView textView=findViewById(R.id.text);
textView.setText("String_Node_Str");
break;
}
return super.onOptionsItemSelected(item);
}
Program: 165208
Project: 165208
Buggy source:
/** 
 * Seeing as this repo already exists, we will force it to be enabled again.
 */
private void updateAndEnableExistingRepo(String url,String fingerprint){
  if (fingerprint != null) {
    fingerprint=fingerprint.trim();
    if (TextUtils.isEmpty(fingerprint)) {
      fingerprint=null;
    }
 else {
      fingerprint=fingerprint.toUpperCase(Locale.ENGLISH);
    }
  }
  Utils.debugLog(TAG,"String_Node_Str" + url);
  Repo repo=fingerprintRepoMap.get(fingerprint);
  if (repo == null) {
    repo=RepoProvider.Helper.findByAddress(context,url);
  }
  ContentValues values=new ContentValues(2);
  values.put(RepoTable.Cols.IN_USE,1);
  values.put(RepoTable.Cols.FINGERPRINT,fingerprint);
  if (!TextUtils.equals(url,repo.address)) {
    boolean addUserMirror=true;
    for (    String mirror : repo.getMirrorList()) {
      if (TextUtils.equals(mirror,url)) {
        addUserMirror=false;
      }
    }
    if (addUserMirror) {
      if (repo.userMirrors == null) {
        repo.userMirrors=new String[]{url};
      }
 else {
        int last=repo.userMirrors.length;
        repo.userMirrors=Arrays.copyOf(repo.userMirrors,last);
        repo.userMirrors[last]=url;
      }
      values.put(RepoTable.Cols.USER_MIRRORS,Utils.serializeCommaSeparatedString(repo.userMirrors));
    }
  }
  RepoProvider.Helper.update(context,repo,values);
  notifyDataSetChanged();
  finishedAddingRepo();
}

Fixed version (ground truth):
/** 
 * Seeing as this repo already exists, we will force it to be enabled again.
 */
private void updateAndEnableExistingRepo(String url,String fingerprint){
  if (fingerprint != null) {
    fingerprint=fingerprint.trim();
    if (TextUtils.isEmpty(fingerprint)) {
      fingerprint=null;
    }
 else {
      fingerprint=fingerprint.toUpperCase(Locale.ENGLISH);
    }
  }
  Utils.debugLog(TAG,"String_Node_Str" + url);
  Repo repo=fingerprintRepoMap.get(fingerprint);
  if (repo == null) {
    repo=RepoProvider.Helper.findByAddress(context,url);
  }
  ContentValues values=new ContentValues(2);
  values.put(RepoTable.Cols.IN_USE,1);
  values.put(RepoTable.Cols.FINGERPRINT,fingerprint);
  if (!TextUtils.equals(url,repo.address)) {
    boolean addUserMirror=true;
    for (    String mirror : repo.getMirrorList()) {
      if (TextUtils.equals(mirror,url)) {
        addUserMirror=false;
      }
    }
    if (addUserMirror) {
      if (repo.userMirrors == null) {
        repo.userMirrors=new String[]{url};
      }
 else {
        int last=repo.userMirrors.length;
        repo.userMirrors=Arrays.copyOf(repo.userMirrors,last + 1);
        repo.userMirrors[last]=url;
      }
      values.put(RepoTable.Cols.USER_MIRRORS,Utils.serializeCommaSeparatedString(repo.userMirrors));
    }
  }
  RepoProvider.Helper.update(context,repo,values);
  notifyDataSetChanged();
  finishedAddingRepo();
}
Program: 165209
Project: 165209
Buggy source:
/** 
 * Figures out the current install/update/download/etc status for the app we are viewing. Then, asks the view to update itself to reflect this status.
 */
private void refreshStatus(){
  Iterator<AppUpdateStatusManager.AppUpdateStatus> statuses=AppUpdateStatusManager.getInstance(this).getByPackageName(app.packageName).iterator();
  if (statuses.hasNext()) {
    AppUpdateStatusManager.AppUpdateStatus status=statuses.next();
    updateAppStatus(status,false);
  }
  currentStatus=null;
}

Fixed version (ground truth):
/** 
 * Figures out the current install/update/download/etc status for the app we are viewing. Then, asks the view to update itself to reflect this status.
 */
private void refreshStatus(){
  AppUpdateStatusManager ausm=AppUpdateStatusManager.getInstance(this);
  Iterator<AppUpdateStatusManager.AppUpdateStatus> statuses=ausm.getByPackageName(app.packageName).iterator();
  if (statuses.hasNext()) {
    AppUpdateStatusManager.AppUpdateStatus status=statuses.next();
    updateAppStatus(status,false);
  }
  currentStatus=null;
}
Program: 165210
Project: 165210
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == R.id.action_share) {
    Intent shareIntent=new Intent(Intent.ACTION_SEND);
    shareIntent.setType("String_Node_Str");
    shareIntent.putExtra(Intent.EXTRA_SUBJECT,app.name);
    shareIntent.putExtra(Intent.EXTRA_TEXT,app.name + "String_Node_Str" + app.summary+ "String_Node_Str"+ app.packageName);
    boolean showNearbyItem=app.isInstalled(getApplicationContext()) && fdroidApp.bluetoothAdapter != null;
    ShareChooserDialog.createChooser((CoordinatorLayout)findViewById(R.id.rootCoordinator),this,this,shareIntent,showNearbyItem);
    return true;
  }
 else   if (item.getItemId() == R.id.action_ignore_all) {
    app.getPrefs(this).ignoreAllUpdates^=true;
    item.setChecked(app.getPrefs(this).ignoreAllUpdates);
    AppPrefsProvider.Helper.update(this,app,app.getPrefs(this));
    return true;
  }
 else   if (item.getItemId() == R.id.action_ignore_this) {
    if (app.getPrefs(this).ignoreThisUpdate >= app.suggestedVersionCode) {
      app.getPrefs(this).ignoreThisUpdate=0;
    }
 else {
      app.getPrefs(this).ignoreThisUpdate=app.suggestedVersionCode;
    }
    item.setChecked(app.getPrefs(this).ignoreThisUpdate > 0);
    AppPrefsProvider.Helper.update(this,app,app.getPrefs(this));
    return true;
  }
 else   if (item.getItemId() == android.R.id.home) {
    onBackPressed();
    return true;
  }
  return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == R.id.action_share) {
    Intent shareIntent=new Intent(Intent.ACTION_SEND);
    shareIntent.setType("String_Node_Str");
    shareIntent.putExtra(Intent.EXTRA_SUBJECT,app.name);
    shareIntent.putExtra(Intent.EXTRA_TEXT,app.name + "String_Node_Str" + app.summary+ "String_Node_Str"+ app.packageName);
    boolean showNearbyItem=app.isInstalled(getApplicationContext()) && fdroidApp.bluetoothAdapter != null;
    CoordinatorLayout coordinatorLayout=(CoordinatorLayout)findViewById(R.id.rootCoordinator);
    ShareChooserDialog.createChooser(coordinatorLayout,this,this,shareIntent,showNearbyItem);
    return true;
  }
 else   if (item.getItemId() == R.id.action_ignore_all) {
    app.getPrefs(this).ignoreAllUpdates^=true;
    item.setChecked(app.getPrefs(this).ignoreAllUpdates);
    AppPrefsProvider.Helper.update(this,app,app.getPrefs(this));
    return true;
  }
 else   if (item.getItemId() == R.id.action_ignore_this) {
    if (app.getPrefs(this).ignoreThisUpdate >= app.suggestedVersionCode) {
      app.getPrefs(this).ignoreThisUpdate=0;
    }
 else {
      app.getPrefs(this).ignoreThisUpdate=app.suggestedVersionCode;
    }
    item.setChecked(app.getPrefs(this).ignoreThisUpdate > 0);
    AppPrefsProvider.Helper.update(this,app,app.getPrefs(this));
    return true;
  }
 else   if (item.getItemId() == android.R.id.home) {
    onBackPressed();
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 165211
Project: 165211
Buggy source:
/** 
 * If passed null, this will show a message to the user ("Could not find app ..." or something like that) and then finish the activity.
 */
private void setApp(App newApp){
  if (newApp == null) {
    Toast.makeText(this,R.string.no_such_app,Toast.LENGTH_LONG).show();
    finish();
    return;
  }
  app=newApp;
  AppUpdateStatusManager appUpdateStatusManager=AppUpdateStatusManager.getInstance(this);
  for (  AppUpdateStatusManager.AppUpdateStatus status : appUpdateStatusManager.getByPackageName(app.packageName)) {
    if (status.status == AppUpdateStatusManager.Status.Installed) {
      appUpdateStatusManager.removeApk(status.getUniqueKey());
    }
  }
}

Fixed version (ground truth):
/** 
 * If passed null, this will show a message to the user ("Could not find app ..." or something like that) and then finish the activity.
 */
private void setApp(App newApp){
  if (newApp == null) {
    Toast.makeText(this,R.string.no_such_app,Toast.LENGTH_LONG).show();
    finish();
    return;
  }
  app=newApp;
  AppUpdateStatusManager ausm=AppUpdateStatusManager.getInstance(this);
  for (  AppUpdateStatusManager.AppUpdateStatus status : ausm.getByPackageName(app.packageName)) {
    if (status.status == AppUpdateStatusManager.Status.Installed) {
      ausm.removeApk(status.getUniqueKey());
    }
  }
}
Program: 165212
Project: 165212
Buggy source:
/** 
 * Some notifications (like "downloading" and "installed") are not shown for this app if it is open in app details. When closing, we need to refresh the notifications, so they are displayed again.
 */
private void updateNotificationsForApp(){
  if (app != null) {
    AppUpdateStatusManager appUpdateStatusManager=AppUpdateStatusManager.getInstance(this);
    for (    AppUpdateStatusManager.AppUpdateStatus status : appUpdateStatusManager.getByPackageName(app.packageName)) {
      if (status.status == AppUpdateStatusManager.Status.Installed) {
        appUpdateStatusManager.removeApk(status.getUniqueKey());
      }
 else {
        appUpdateStatusManager.refreshApk(status.getUniqueKey());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Some notifications (like "downloading" and "installed") are not shown for this app if it is open in app details.  When closing, we need to refresh the notifications, so they are displayed again.
 */
private void updateNotificationsForApp(){
  if (app != null) {
    AppUpdateStatusManager ausm=AppUpdateStatusManager.getInstance(this);
    for (    AppUpdateStatusManager.AppUpdateStatus status : ausm.getByPackageName(app.packageName)) {
      if (status.status == AppUpdateStatusManager.Status.Installed) {
        ausm.removeApk(status.getUniqueKey());
      }
 else {
        ausm.refreshApk(status.getUniqueKey());
      }
    }
  }
}
Program: 165213
Project: 165213
Buggy source:
private void updateApkInternal(@NonNull AppUpdateStatus entry,@NonNull Status status,PendingIntent intent){
  Utils.debugLog(LOGTAG,"String_Node_Str" + entry.apk.apkName + "String_Node_Str"+ status.name());
  boolean isStatusUpdate=(entry.status != status);
  entry.status=status;
  entry.intent=intent;
  if (entry.intent == null) {
    entry.intent=getContentIntent(entry);
  }
  notifyChange(entry,isStatusUpdate);
}

Fixed version (ground truth):
private void updateApkInternal(@NonNull AppUpdateStatus entry,@NonNull Status status,PendingIntent intent){
  Utils.debugLog(LOGTAG,"String_Node_Str" + entry.apk.apkName + "String_Node_Str"+ status.name());
  boolean isStatusUpdate=entry.status != status;
  entry.status=status;
  entry.intent=intent;
  if (entry.intent == null) {
    entry.intent=getContentIntent(entry);
  }
  notifyChange(entry,isStatusUpdate);
}
Program: 165214
Project: 165214
Buggy source:
private boolean shouldIgnoreEntry(AppUpdateStatusManager.AppUpdateStatus entry){
  if (entry.status == AppUpdateStatusManager.Status.Unknown)   return true;
 else   if ((entry.status == AppUpdateStatusManager.Status.Downloading || entry.status == AppUpdateStatusManager.Status.ReadyToInstall || entry.status == AppUpdateStatusManager.Status.InstallError) && (AppDetails.isAppVisible(entry.app.packageName) || AppDetails2.isAppVisible(entry.app.packageName)))   return true;
  return false;
}

Fixed version (ground truth):
private boolean shouldIgnoreEntry(AppUpdateStatusManager.AppUpdateStatus entry){
  if (entry.status == AppUpdateStatusManager.Status.Unknown) {
    return true;
  }
 else   if ((entry.status == AppUpdateStatusManager.Status.Downloading || entry.status == AppUpdateStatusManager.Status.ReadyToInstall || entry.status == AppUpdateStatusManager.Status.InstallError) && (AppDetails.isAppVisible(entry.app.packageName) || AppDetails2.isAppVisible(entry.app.packageName))) {
    return true;
  }
  return false;
}
Program: 165215
Project: 165215
Buggy source:
private Point getLargeIconSize(){
  int w;
  int h;
  if (Build.VERSION.SDK_INT >= 11) {
    w=context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
    h=context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
  }
 else {
    w=h=context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
  }
  return new Point(w,h);
}

Fixed version (ground truth):
private Point getLargeIconSize(){
  int w;
  int h;
  if (Build.VERSION.SDK_INT >= 11) {
    w=context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
    h=context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
  }
 else {
    w=context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
    h=w;
  }
  return new Point(w,h);
}
Program: 165216
Project: 165216
Buggy source:
@Override public void onReceive(Context context,Intent intent){
switch (intent.getAction()) {
case AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED:
    notificationManager.cancelAll();
  updateStatusLists();
createSummaryNotifications();
for (AppUpdateStatusManager.AppUpdateStatus entry : appUpdateStatusManager.getAll()) {
createNotification(entry);
}
break;
case AppUpdateStatusManager.BROADCAST_APPSTATUS_ADDED:
{
updateStatusLists();
createSummaryNotifications();
String url=intent.getStringExtra(AppUpdateStatusManager.EXTRA_APK_URL);
AppUpdateStatusManager.AppUpdateStatus entry=appUpdateStatusManager.get(url);
if (entry != null) {
createNotification(entry);
}
break;
}
case AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED:
{
String url=intent.getStringExtra(AppUpdateStatusManager.EXTRA_APK_URL);
AppUpdateStatusManager.AppUpdateStatus entry=appUpdateStatusManager.get(url);
updateStatusLists();
if (entry != null) {
createNotification(entry);
}
if (intent.getBooleanExtra(AppUpdateStatusManager.EXTRA_IS_STATUS_UPDATE,false)) {
createSummaryNotifications();
}
break;
}
case AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED:
{
String url=intent.getStringExtra(AppUpdateStatusManager.EXTRA_APK_URL);
notificationManager.cancel(url,NOTIFY_ID_INSTALLED);
notificationManager.cancel(url,NOTIFY_ID_UPDATES);
updateStatusLists();
createSummaryNotifications();
break;
}
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  AppUpdateStatusManager.AppUpdateStatus entry;
  String url;
switch (intent.getAction()) {
case AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED:
    notificationManager.cancelAll();
  updateStatusLists();
createSummaryNotifications();
for (AppUpdateStatusManager.AppUpdateStatus appUpdateStatus : appUpdateStatusManager.getAll()) {
createNotification(appUpdateStatus);
}
break;
case AppUpdateStatusManager.BROADCAST_APPSTATUS_ADDED:
updateStatusLists();
createSummaryNotifications();
url=intent.getStringExtra(AppUpdateStatusManager.EXTRA_APK_URL);
entry=appUpdateStatusManager.get(url);
if (entry != null) {
createNotification(entry);
}
break;
case AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED:
url=intent.getStringExtra(AppUpdateStatusManager.EXTRA_APK_URL);
entry=appUpdateStatusManager.get(url);
updateStatusLists();
if (entry != null) {
createNotification(entry);
}
if (intent.getBooleanExtra(AppUpdateStatusManager.EXTRA_IS_STATUS_UPDATE,false)) {
createSummaryNotifications();
}
break;
case AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED:
url=intent.getStringExtra(AppUpdateStatusManager.EXTRA_APK_URL);
notificationManager.cancel(url,NOTIFY_ID_INSTALLED);
notificationManager.cancel(url,NOTIFY_ID_UPDATES);
updateStatusLists();
createSummaryNotifications();
break;
}
}
Program: 165220
Project: 165220
Buggy source:
private Notification createUpdateNotification(AppUpdateStatusManager.AppUpdateStatus entry){
  App app=entry.app;
  AppUpdateStatusManager.Status status=entry.status;
  int iconSmall=R.drawable.ic_launcher;
  Bitmap iconLarge=getLargeIconForEntry(entry);
  NotificationCompat.Builder builder=new NotificationCompat.Builder(context).setAutoCancel(true).setContentTitle(getSingleItemTitleString(app,status)).setContentText(getSingleItemContentString(app,status)).setSmallIcon(iconSmall).setColor(ContextCompat.getColor(context,R.color.fdroid_blue)).setLargeIcon(iconLarge).setLocalOnly(true).setVisibility(NotificationCompat.VISIBILITY_SECRET).setContentIntent(entry.intent);
  if (useStackedNotifications()) {
    builder.setGroup(GROUP_UPDATES);
  }
  NotificationCompat.Action action=getAction(entry);
  if (action != null) {
    builder.addAction(action);
  }
  if (status == AppUpdateStatusManager.Status.Downloading) {
    if (entry.progressMax == 0)     builder.setProgress(100,0,true);
 else     builder.setProgress(entry.progressMax,entry.progressCurrent,false);
  }
 else   if (status == AppUpdateStatusManager.Status.Installing) {
    builder.setProgress(100,0,true);
  }
  Intent intentDeleted=new Intent(BROADCAST_NOTIFICATIONS_UPDATE_CLEARED);
  intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY,entry.getUniqueKey());
  PendingIntent piDeleted=PendingIntent.getBroadcast(context,0,intentDeleted,0);
  builder.setDeleteIntent(piDeleted);
  return builder.build();
}

Fixed version (ground truth):
private Notification createUpdateNotification(AppUpdateStatusManager.AppUpdateStatus entry){
  App app=entry.app;
  AppUpdateStatusManager.Status status=entry.status;
  int iconSmall=R.drawable.ic_launcher;
  Bitmap iconLarge=getLargeIconForEntry(entry);
  NotificationCompat.Builder builder=new NotificationCompat.Builder(context).setAutoCancel(true).setContentTitle(getSingleItemTitleString(app,status)).setContentText(getSingleItemContentString(app,status)).setSmallIcon(iconSmall).setColor(ContextCompat.getColor(context,R.color.fdroid_blue)).setLargeIcon(iconLarge).setLocalOnly(true).setVisibility(NotificationCompat.VISIBILITY_SECRET).setContentIntent(entry.intent);
  if (useStackedNotifications()) {
    builder.setGroup(GROUP_UPDATES);
  }
  NotificationCompat.Action action=getAction(entry);
  if (action != null) {
    builder.addAction(action);
  }
  if (status == AppUpdateStatusManager.Status.Downloading) {
    if (entry.progressMax == 0) {
      builder.setProgress(100,0,true);
    }
 else {
      builder.setProgress(entry.progressMax,entry.progressCurrent,false);
    }
  }
 else   if (status == AppUpdateStatusManager.Status.Installing) {
    builder.setProgress(100,0,true);
  }
  Intent intentDeleted=new Intent(BROADCAST_NOTIFICATIONS_UPDATE_CLEARED);
  intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY,entry.getUniqueKey());
  PendingIntent piDeleted=PendingIntent.getBroadcast(context,0,intentDeleted,0);
  builder.setDeleteIntent(piDeleted);
  return builder.build();
}
Program: 165221
Project: 165221
Buggy source:
@Override public void run(){
  if (descriptionView.getLineCount() < HeaderViewHolder.MAX_LINES) {
    descriptionMoreView.setVisibility(View.GONE);
  }
 else {
    descriptionMoreView.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (descriptionView.getLineCount() <= HeaderViewHolder.MAX_LINES) {
    descriptionMoreView.setVisibility(View.GONE);
  }
 else {
    descriptionMoreView.setVisibility(View.VISIBLE);
  }
}
Program: 165223
Project: 165223
Buggy source:
private void initTable(){
  final SQLiteDatabase db=db();
  ensureTempTableDetached(db);
  db.execSQL("String_Node_Str" + DB);
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.NAME);
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.Cols.PACKAGE_NAME+ "String_Node_Str");
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.Cols.UPSTREAM_VERSION_CODE+ "String_Node_Str");
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.Cols.IS_COMPATIBLE+ "String_Node_Str");
}

Fixed version (ground truth):
private void initTable(){
  final SQLiteDatabase db=db();
  ensureTempTableDetached(db);
  db.execSQL("String_Node_Str" + DB);
  db.execSQL(DBHelper.CREATE_TABLE_APP.replaceFirst(AppMetadataTable.NAME,DB + "String_Node_Str" + getTableName()));
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.NAME);
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.Cols.PACKAGE_NAME+ "String_Node_Str");
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.Cols.UPSTREAM_VERSION_CODE+ "String_Node_Str");
  db.execSQL("String_Node_Str" + DB + "String_Node_Str"+ getTableName()+ "String_Node_Str"+ AppMetadataTable.Cols.IS_COMPATIBLE+ "String_Node_Str");
}
Program: 165224
Project: 165224
Buggy source:
/** 
 * Recursively delete files in   {@code f} that were last used{@code millisAgo} milliseconds ago.  On {@code android-21} and newer, thisis based on the last access of the file, on older Android versions, it is based on the last time the file was modified, e.g. downloaded.
 * @param f         The file or directory to clean
 * @param millisAgo The number of milliseconds old that marks a file for deletion.
 */
public static void clearOldFiles(File f,long millisAgo){
  if (f == null) {
    return;
  }
  long olderThan=System.currentTimeMillis() - millisAgo;
  if (f.isDirectory()) {
    File[] files=f.listFiles();
    if (files == null) {
      return;
    }
    for (    File file : files) {
      clearOldFiles(file,millisAgo);
    }
    f.delete();
  }
 else   if (Build.VERSION.SDK_INT < 21) {
    if (FileUtils.isFileOlder(f,olderThan)) {
      f.delete();
    }
  }
 else {
    CleanCacheService21.deleteIfOld(f,millisAgo);
  }
}

Fixed version (ground truth):
/** 
 * Recursively delete files in   {@code f} that were last used{@code millisAgo} milliseconds ago.  On {@code android-21} and newer, thisis based on the last access of the file, on older Android versions, it is based on the last time the file was modified, e.g. downloaded.
 * @param f         The file or directory to clean
 * @param millisAgo The number of milliseconds old that marks a file for deletion.
 */
public static void clearOldFiles(File f,long millisAgo){
  if (f == null) {
    return;
  }
  long olderThan=System.currentTimeMillis() - millisAgo;
  if (f.isDirectory()) {
    File[] files=f.listFiles();
    if (files == null) {
      return;
    }
    for (    File file : files) {
      clearOldFiles(file,millisAgo);
    }
    f.delete();
  }
 else   if (Build.VERSION.SDK_INT < 21) {
    if (FileUtils.isFileOlder(f,olderThan)) {
      f.delete();
    }
  }
 else {
    CleanCacheService21.deleteIfOld(f,olderThan);
  }
}
Program: 165225
Project: 165225
Buggy source:
/** 
 * Recursively delete files in   {@code dir} that were last used{@code millisAgo} milliseconds ago.  On {@code android-21} and newer, thisis based on the last access of the file, on older Android versions, it is based on the last time the file was modified, e.g. downloaded.
 * @param dir        The directory to recurse in
 * @param millisAgo The number of milliseconds old that marks a file for deletion.
 */
@TargetApi(21) public static void clearOldFiles(File dir,long millisAgo){
  if (dir == null) {
    return;
  }
  File[] files=dir.listFiles();
  if (files == null) {
    return;
  }
  long olderThan=System.currentTimeMillis() - millisAgo;
  for (  File f : files) {
    if (f.isDirectory()) {
      clearOldFiles(f,olderThan);
      f.delete();
    }
    if (Build.VERSION.SDK_INT < 21) {
      if (FileUtils.isFileOlder(f,olderThan)) {
        f.delete();
      }
    }
 else {
      try {
        StructStat stat=Os.lstat(f.getAbsolutePath());
        if ((stat.st_atime * 1000L) < olderThan) {
          f.delete();
        }
      }
 catch (      ErrnoException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Recursively delete files in   {@code dir} that were last used{@code millisAgo} milliseconds ago.  On {@code android-21} and newer, thisis based on the last access of the file, on older Android versions, it is based on the last time the file was modified, e.g. downloaded.
 * @param dir        The directory to recurse in
 * @param millisAgo The number of milliseconds old that marks a file for deletion.
 */
@TargetApi(21) public static void clearOldFiles(File dir,long millisAgo){
  if (dir == null) {
    return;
  }
  File[] files=dir.listFiles();
  if (files == null) {
    return;
  }
  long olderThan=System.currentTimeMillis() - millisAgo;
  for (  File f : files) {
    if (f.isDirectory()) {
      clearOldFiles(f,millisAgo);
      f.delete();
    }
    if (Build.VERSION.SDK_INT < 21) {
      if (FileUtils.isFileOlder(f,olderThan)) {
        f.delete();
      }
    }
 else {
      try {
        StructStat stat=Os.lstat(f.getAbsolutePath());
        if ((stat.st_atime * 1000L) < olderThan) {
          f.delete();
        }
      }
 catch (      ErrnoException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 165226
Project: 165226
Buggy source:
/** 
 * Recursively delete files in   {@code f} that were last used{@code millisAgo} milliseconds ago.  On {@code android-21} and newer, thisis based on the last access of the file, on older Android versions, it is based on the last time the file was modified, e.g. downloaded.
 * @param f         The file or directory to clean
 * @param millisAgo The number of milliseconds old that marks a file for deletion.
 */
@TargetApi(21) public static void clearOldFiles(File f,long millisAgo){
  if (f == null) {
    return;
  }
  long olderThan=System.currentTimeMillis() - millisAgo;
  if (f.isDirectory()) {
    File[] files=f.listFiles();
    if (files == null) {
      return;
    }
    for (    File file : files) {
      clearOldFiles(file,millisAgo);
    }
    f.delete();
  }
 else   if (Build.VERSION.SDK_INT < 21) {
    if (FileUtils.isFileOlder(f,olderThan)) {
      f.delete();
    }
  }
 else {
    try {
      StructStat stat=Os.lstat(f.getAbsolutePath());
      if ((stat.st_atime * 1000L) < olderThan) {
        f.delete();
      }
    }
 catch (    ErrnoException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Recursively delete files in   {@code f} that were last used{@code millisAgo} milliseconds ago.  On {@code android-21} and newer, thisis based on the last access of the file, on older Android versions, it is based on the last time the file was modified, e.g. downloaded.
 * @param f         The file or directory to clean
 * @param millisAgo The number of milliseconds old that marks a file for deletion.
 */
public static void clearOldFiles(File f,long millisAgo){
  if (f == null) {
    return;
  }
  long olderThan=System.currentTimeMillis() - millisAgo;
  if (f.isDirectory()) {
    File[] files=f.listFiles();
    if (files == null) {
      return;
    }
    for (    File file : files) {
      clearOldFiles(file,millisAgo);
    }
    f.delete();
  }
 else   if (Build.VERSION.SDK_INT < 21) {
    if (FileUtils.isFileOlder(f,olderThan)) {
      f.delete();
    }
  }
 else {
    CleanCacheService21.deleteIfOld(f,millisAgo);
  }
}
Program: 165227
Project: 165227
Buggy source:
/** 
 * If any column was added or removed, just drop the table, create it again and let the cache be filled from scratch by   {@link InstalledAppProviderService}For DB versions older than 43, this will create the   {@link InstalledAppProvider}table for the first time.
 */
private void recreateInstalledAppTable(SQLiteDatabase db,int oldVersion){
  if (oldVersion >= 57) {
    return;
  }
  Utils.debugLog(TAG,"String_Node_Str");
  db.execSQL(DROP_TABLE_INSTALLED_APP);
  db.execSQL(CREATE_TABLE_INSTALLED_APP);
}

Fixed version (ground truth):
/** 
 * If any column was added or removed, just drop the table, create it again and let the cache be filled from scratch by   {@link InstalledAppProviderService}For DB versions older than 43, this will create the   {@link InstalledAppProvider}table for the first time.
 */
private void recreateInstalledAppTable(SQLiteDatabase db,int oldVersion){
  if (oldVersion >= 56) {
    return;
  }
  Utils.debugLog(TAG,"String_Node_Str");
  db.execSQL(DROP_TABLE_INSTALLED_APP);
  db.execSQL(CREATE_TABLE_INSTALLED_APP);
}
Program: 165228
Project: 165228
Buggy source:
private void doDeletePackageInternal(final String packageName) throws InstallFailedException {
  ServiceConnection mServiceConnection=new ServiceConnection(){
    public void onServiceConnected(    ComponentName name,    IBinder service){
      IPrivilegedService privService=IPrivilegedService.Stub.asInterface(service);
      IPrivilegedCallback callback=new IPrivilegedCallback.Stub(){
        @Override public void handleResult(        String packageName,        int returnCode) throws RemoteException {
          if (returnCode == DELETE_SUCCEEDED) {
            sendBroadcastUninstall(packageName,ACTION_UNINSTALL_COMPLETE);
          }
 else {
            sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str" + returnCode + "String_Node_Str"+ sUninstallReturnCodes.get(returnCode));
          }
        }
      }
;
      try {
        privService.deletePackage(packageName,0,callback);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
        sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
      }
    }
    public void onServiceDisconnected(    ComponentName name){
    }
  }
;
  Intent serviceIntent=new Intent(PRIVILEGED_EXTENSION_SERVICE_INTENT);
  serviceIntent.setPackage(PRIVILEGED_EXTENSION_PACKAGE_NAME);
  mContext.getApplicationContext().bindService(serviceIntent,mServiceConnection,Context.BIND_AUTO_CREATE);
}

Fixed version (ground truth):
private void doDeletePackageInternal(final String packageName) throws InstallFailedException {
  ServiceConnection mServiceConnection=new ServiceConnection(){
    public void onServiceConnected(    ComponentName name,    IBinder service){
      IPrivilegedService privService=IPrivilegedService.Stub.asInterface(service);
      IPrivilegedCallback callback=new IPrivilegedCallback.Stub(){
        @Override public void handleResult(        String packageName,        int returnCode) throws RemoteException {
          if (returnCode == DELETE_SUCCEEDED) {
            sendBroadcastUninstall(packageName,ACTION_UNINSTALL_COMPLETE);
          }
 else {
            sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str" + returnCode + "String_Node_Str"+ UNINSTALL_RETURN_CODES.get(returnCode));
          }
        }
      }
;
      try {
        privService.deletePackage(packageName,0,callback);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
        sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
      }
    }
    public void onServiceDisconnected(    ComponentName name){
    }
  }
;
  Intent serviceIntent=new Intent(PRIVILEGED_EXTENSION_SERVICE_INTENT);
  serviceIntent.setPackage(PRIVILEGED_EXTENSION_PACKAGE_NAME);
  mContext.getApplicationContext().bindService(serviceIntent,mServiceConnection,Context.BIND_AUTO_CREATE);
}
Program: 165229
Project: 165229
Buggy source:
public void onServiceConnected(ComponentName name,IBinder service){
  IPrivilegedService privService=IPrivilegedService.Stub.asInterface(service);
  IPrivilegedCallback callback=new IPrivilegedCallback.Stub(){
    @Override public void handleResult(    String packageName,    int returnCode) throws RemoteException {
      if (returnCode == DELETE_SUCCEEDED) {
        sendBroadcastUninstall(packageName,ACTION_UNINSTALL_COMPLETE);
      }
 else {
        sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str" + returnCode + "String_Node_Str"+ sUninstallReturnCodes.get(returnCode));
      }
    }
  }
;
  try {
    privService.deletePackage(packageName,0,callback);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void onServiceConnected(ComponentName name,IBinder service){
  IPrivilegedService privService=IPrivilegedService.Stub.asInterface(service);
  IPrivilegedCallback callback=new IPrivilegedCallback.Stub(){
    @Override public void handleResult(    String packageName,    int returnCode) throws RemoteException {
      if (returnCode == DELETE_SUCCEEDED) {
        sendBroadcastUninstall(packageName,ACTION_UNINSTALL_COMPLETE);
      }
 else {
        sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str" + returnCode + "String_Node_Str"+ UNINSTALL_RETURN_CODES.get(returnCode));
      }
    }
  }
;
  try {
    privService.deletePackage(packageName,0,callback);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
  }
}
Program: 165230
Project: 165230
Buggy source:
@Override public void handleResult(String packageName,int returnCode) throws RemoteException {
  if (returnCode == DELETE_SUCCEEDED) {
    sendBroadcastUninstall(packageName,ACTION_UNINSTALL_COMPLETE);
  }
 else {
    sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str" + returnCode + "String_Node_Str"+ sUninstallReturnCodes.get(returnCode));
  }
}

Fixed version (ground truth):
@Override public void handleResult(String packageName,int returnCode) throws RemoteException {
  if (returnCode == DELETE_SUCCEEDED) {
    sendBroadcastUninstall(packageName,ACTION_UNINSTALL_COMPLETE);
  }
 else {
    sendBroadcastUninstall(packageName,ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str" + returnCode + "String_Node_Str"+ UNINSTALL_RETURN_CODES.get(returnCode));
  }
}
Program: 165232
Project: 165232
Buggy source:
private byte[] getApkSignature(File apkFile){
  final String pkgPath=apkFile.getAbsolutePath();
  PackageInfo pkgInfo=mPm.getPackageArchiveInfo(pkgPath,PackageManager.GET_SIGNATURES);
  return signatureToBytes(pkgInfo.signatures);
}

Fixed version (ground truth):
private byte[] getApkSignature(File apkFile){
  final String pkgPath=apkFile.getAbsolutePath();
  PackageInfo pkgInfo=pm.getPackageArchiveInfo(pkgPath,PackageManager.GET_SIGNATURES);
  return signatureToBytes(pkgInfo.signatures);
}
Program: 165233
Project: 165233
Buggy source:
private byte[] getFDroidSignature(){
  try {
    @SuppressLint("String_Node_Str") PackageInfo pkgInfo=mPm.getPackageInfo(mContext.getPackageName(),PackageManager.GET_SIGNATURES);
    return signatureToBytes(pkgInfo.signatures);
  }
 catch (  PackageManager.NameNotFoundException e) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
private byte[] getFDroidSignature(){
  try {
    @SuppressLint("String_Node_Str") PackageInfo pkgInfo=pm.getPackageInfo(context.getPackageName(),PackageManager.GET_SIGNATURES);
    return signatureToBytes(pkgInfo.signatures);
  }
 catch (  PackageManager.NameNotFoundException e) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 165234
Project: 165234
Buggy source:
ApkSignatureVerifier(Context context){
  mContext=context;
  mPm=context.getPackageManager();
}

Fixed version (ground truth):
ApkSignatureVerifier(Context context){
  this.context=context;
  pm=context.getPackageManager();
}