nus-yam/ex-repair huggingface dataset:
Program: 165235
Project: 165235
Buggy source:
@Override protected void uninstallPackage(String packageName){
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_STARTED);
  Intent uninstallIntent=new Intent(mContext,DefaultInstallerActivity.class);
  uninstallIntent.setAction(DefaultInstallerActivity.ACTION_UNINSTALL_PACKAGE);
  uninstallIntent.putExtra(DefaultInstallerActivity.EXTRA_UNINSTALL_PACKAGE_NAME,packageName);
  PendingIntent uninstallPendingIntent=PendingIntent.getActivity(mContext.getApplicationContext(),packageName.hashCode(),uninstallIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_USER_INTERACTION,uninstallPendingIntent);
}

Fixed version (ground truth):
@Override protected void uninstallPackage(String packageName){
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_STARTED);
  Intent uninstallIntent=new Intent(context,DefaultInstallerActivity.class);
  uninstallIntent.setAction(DefaultInstallerActivity.ACTION_UNINSTALL_PACKAGE);
  uninstallIntent.putExtra(DefaultInstallerActivity.EXTRA_UNINSTALL_PACKAGE_NAME,packageName);
  PendingIntent uninstallPendingIntent=PendingIntent.getActivity(context.getApplicationContext(),packageName.hashCode(),uninstallIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_USER_INTERACTION,uninstallPendingIntent);
}
Program: 165236
Project: 165236
Buggy source:
@Override protected void installPackage(Uri uri,Uri originatingUri,String packageName){
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_STARTED);
  Utils.debugLog(TAG,"String_Node_Str" + uri + "String_Node_Str"+ new File(uri.getPath()));
  Uri sanitizedUri;
  try {
    sanitizedUri=Installer.prepareApkFile(mContext,uri,packageName);
  }
 catch (  Installer.InstallFailedException e) {
    Log.e(TAG,"String_Node_Str",e);
    sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,e.getMessage());
    return;
  }
  Intent installIntent=new Intent(mContext,DefaultInstallerActivity.class);
  installIntent.setAction(DefaultInstallerActivity.ACTION_INSTALL_PACKAGE);
  installIntent.putExtra(DefaultInstallerActivity.EXTRA_ORIGINATING_URI,originatingUri);
  installIntent.setData(sanitizedUri);
  PendingIntent installPendingIntent=PendingIntent.getActivity(mContext.getApplicationContext(),uri.hashCode(),installIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_USER_INTERACTION,installPendingIntent);
}

Fixed version (ground truth):
@Override protected void installPackage(Uri uri,Uri originatingUri,String packageName){
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_STARTED);
  Utils.debugLog(TAG,"String_Node_Str" + uri + "String_Node_Str"+ new File(uri.getPath()));
  Uri sanitizedUri;
  try {
    sanitizedUri=Installer.prepareApkFile(context,uri,packageName);
  }
 catch (  Installer.InstallFailedException e) {
    Log.e(TAG,"String_Node_Str",e);
    sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,e.getMessage());
    return;
  }
  Intent installIntent=new Intent(context,DefaultInstallerActivity.class);
  installIntent.setAction(DefaultInstallerActivity.ACTION_INSTALL_PACKAGE);
  installIntent.putExtra(DefaultInstallerActivity.EXTRA_ORIGINATING_URI,originatingUri);
  installIntent.setData(sanitizedUri);
  PendingIntent installPendingIntent=PendingIntent.getActivity(context.getApplicationContext(),uri.hashCode(),installIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_USER_INTERACTION,installPendingIntent);
}
Program: 165237
Project: 165237
Buggy source:
protected void uninstallPackage(String packageName){
  Intent intent=new Intent();
  try {
    getPackageManager().getPackageInfo(packageName,0);
  }
 catch (  PackageManager.NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    installer.sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
    finish();
    return;
  }
  Uri uri=Uri.fromParts("String_Node_Str",packageName,null);
  intent.setData(uri);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    intent.setAction(Intent.ACTION_DELETE);
  }
 else {
    intent.setAction(Intent.ACTION_UNINSTALL_PACKAGE);
    intent.putExtra(Intent.EXTRA_RETURN_RESULT,true);
  }
  try {
    startActivityForResult(intent,REQUEST_CODE_UNINSTALL);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    installer.sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
    finish();
  }
}

Fixed version (ground truth):
protected void uninstallPackage(String packageName){
  try {
    getPackageManager().getPackageInfo(packageName,0);
  }
 catch (  PackageManager.NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    installer.sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
    finish();
    return;
  }
  Uri uri=Uri.fromParts("String_Node_Str",packageName,null);
  Intent intent=new Intent();
  intent.setData(uri);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    intent.setAction(Intent.ACTION_DELETE);
  }
 else {
    intent.setAction(Intent.ACTION_UNINSTALL_PACKAGE);
    intent.putExtra(Intent.EXTRA_RETURN_RESULT,true);
  }
  try {
    startActivityForResult(intent,REQUEST_CODE_UNINSTALL);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    installer.sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_INTERRUPTED,"String_Node_Str");
    finish();
  }
}
Program: 165238
Project: 165238
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  installer=new DefaultInstaller(this);
  Intent intent=getIntent();
  String action=intent.getAction();
switch (action) {
case ACTION_INSTALL_PACKAGE:
{
      mInstallUri=intent.getData();
      mInstallOriginatingUri=intent.getParcelableExtra(EXTRA_ORIGINATING_URI);
      installPackage(mInstallUri,mInstallOriginatingUri);
      break;
    }
case ACTION_UNINSTALL_PACKAGE:
{
    mUninstallPackageName=intent.getStringExtra(EXTRA_UNINSTALL_PACKAGE_NAME);
    uninstallPackage(mUninstallPackageName);
    break;
  }
default :
{
  throw new IllegalStateException("String_Node_Str");
}
}
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  installer=new DefaultInstaller(this);
  Intent intent=getIntent();
  String action=intent.getAction();
switch (action) {
case ACTION_INSTALL_PACKAGE:
{
      installUri=intent.getData();
      installOriginatingUri=intent.getParcelableExtra(EXTRA_ORIGINATING_URI);
      installPackage(installUri,installOriginatingUri);
      break;
    }
case ACTION_UNINSTALL_PACKAGE:
{
    uninstallPackageName=intent.getStringExtra(EXTRA_UNINSTALL_PACKAGE_NAME);
    uninstallPackage(uninstallPackageName);
    break;
  }
default :
{
  throw new IllegalStateException("String_Node_Str");
}
}
}
Program: 165239
Project: 165239
Buggy source:
@SuppressLint("String_Node_Str") private void installPackage(Uri uri,Uri originatingUri){
  Utils.debugLog(TAG,"String_Node_Str" + uri);
  if (uri == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if ((Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) && (!uri.getScheme().equals("String_Node_Str"))) {
    throw new RuntimeException("String_Node_Str");
  }
  if (("String_Node_Str".equals(Build.VERSION.CODENAME)) && (!uri.getScheme().equals("String_Node_Str"))) {
    throw new RuntimeException("String_Node_Str");
  }
  Intent intent=new Intent();
  intent.setData(uri);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    intent.setAction(Intent.ACTION_VIEW);
    intent.setType("String_Node_Str");
  }
 else {
    intent.setAction(Intent.ACTION_INSTALL_PACKAGE);
    if (!"String_Node_Str".equals(Build.VERSION.CODENAME)) {
      intent.putExtra(Intent.EXTRA_RETURN_RESULT,true);
    }
    intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE,true);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
      intent.putExtra(Intent.EXTRA_ALLOW_REPLACE,true);
    }
  }
  try {
    startActivityForResult(intent,REQUEST_CODE_INSTALL);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    installer.sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,"String_Node_Str");
    finish();
  }
  installer.sendBroadcastInstall(mInstallUri,mInstallOriginatingUri,Installer.ACTION_INSTALL_STARTED);
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private void installPackage(Uri uri,Uri originatingUri){
  if (uri == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if ((Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) && (!uri.getScheme().equals("String_Node_Str"))) {
    throw new RuntimeException("String_Node_Str");
  }
  if (("String_Node_Str".equals(Build.VERSION.CODENAME)) && (!uri.getScheme().equals("String_Node_Str"))) {
    throw new RuntimeException("String_Node_Str");
  }
  Intent intent=new Intent();
  intent.setData(uri);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    intent.setAction(Intent.ACTION_VIEW);
    intent.setType("String_Node_Str");
  }
 else {
    intent.setAction(Intent.ACTION_INSTALL_PACKAGE);
    if (!"String_Node_Str".equals(Build.VERSION.CODENAME)) {
      intent.putExtra(Intent.EXTRA_RETURN_RESULT,true);
    }
    intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE,true);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
      intent.putExtra(Intent.EXTRA_ALLOW_REPLACE,true);
    }
  }
  try {
    startActivityForResult(intent,REQUEST_CODE_INSTALL);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    installer.sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,"String_Node_Str");
    finish();
  }
  installer.sendBroadcastInstall(installUri,installOriginatingUri,Installer.ACTION_INSTALL_STARTED);
}
Program: 165241
Project: 165241
Buggy source:
@Override protected void uninstallPackage(String packageName){
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_STARTED);
  Intent uninstallIntent=new Intent(mContext,InstallExtensionDialogActivity.class);
  uninstallIntent.setAction(InstallExtensionDialogActivity.ACTION_UNINSTALL);
  PendingIntent uninstallPendingIntent=PendingIntent.getActivity(mContext.getApplicationContext(),packageName.hashCode(),uninstallIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_USER_INTERACTION,uninstallPendingIntent);
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_COMPLETE);
}

Fixed version (ground truth):
@Override protected void uninstallPackage(String packageName){
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_STARTED);
  Intent uninstallIntent=new Intent(context,InstallExtensionDialogActivity.class);
  uninstallIntent.setAction(InstallExtensionDialogActivity.ACTION_UNINSTALL);
  PendingIntent uninstallPendingIntent=PendingIntent.getActivity(context.getApplicationContext(),packageName.hashCode(),uninstallIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_USER_INTERACTION,uninstallPendingIntent);
  sendBroadcastUninstall(packageName,Installer.ACTION_UNINSTALL_COMPLETE);
}
Program: 165242
Project: 165242
Buggy source:
@Override protected void installPackage(Uri uri,Uri originatingUri,String packageName){
  Uri sanitizedUri;
  try {
    sanitizedUri=Installer.prepareApkFile(mContext,uri,packageName);
  }
 catch (  InstallFailedException e) {
    Log.e(TAG,"String_Node_Str",e);
    sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,e.getMessage());
    return;
  }
  ApkSignatureVerifier signatureVerifier=new ApkSignatureVerifier(mContext);
  if (!BuildConfig.DEBUG && !signatureVerifier.hasFDroidSignature(new File(sanitizedUri.getPath()))) {
    sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,"String_Node_Str");
  }
  Intent installIntent=new Intent(mContext,InstallExtensionDialogActivity.class);
  installIntent.setAction(InstallExtensionDialogActivity.ACTION_INSTALL);
  installIntent.setData(sanitizedUri);
  PendingIntent installPendingIntent=PendingIntent.getActivity(mContext.getApplicationContext(),uri.hashCode(),installIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_USER_INTERACTION,installPendingIntent);
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_COMPLETE);
}

Fixed version (ground truth):
@Override protected void installPackage(Uri uri,Uri originatingUri,String packageName){
  Uri sanitizedUri;
  try {
    sanitizedUri=Installer.prepareApkFile(context,uri,packageName);
  }
 catch (  InstallFailedException e) {
    Log.e(TAG,"String_Node_Str",e);
    sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,e.getMessage());
    return;
  }
  ApkSignatureVerifier signatureVerifier=new ApkSignatureVerifier(context);
  if (!BuildConfig.DEBUG && !signatureVerifier.hasFDroidSignature(new File(sanitizedUri.getPath()))) {
    sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_INTERRUPTED,"String_Node_Str");
  }
  Intent installIntent=new Intent(context,InstallExtensionDialogActivity.class);
  installIntent.setAction(InstallExtensionDialogActivity.ACTION_INSTALL);
  installIntent.setData(sanitizedUri);
  PendingIntent installPendingIntent=PendingIntent.getActivity(context.getApplicationContext(),uri.hashCode(),installIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_USER_INTERACTION,installPendingIntent);
  sendBroadcastInstall(uri,originatingUri,Installer.ACTION_INSTALL_COMPLETE);
}
Program: 165243
Project: 165243
Buggy source:
private String getAppName(Apk apk){
  App app=ACTIVE_APPS.get(apk.packageName);
  return app.name;
}

Fixed version (ground truth):
private String getAppName(Apk apk){
  return ACTIVE_APPS.get(apk.packageName).name;
}
Program: 165244
Project: 165244
Buggy source:
private int newPermissionCount(Apk apk){
  AppDiff appDiff=new AppDiff(mContext.getPackageManager(),apk);
  if (appDiff.mPkgInfo == null) {
    throw new RuntimeException("String_Node_Str");
  }
  AppSecurityPermissions perms=new AppSecurityPermissions(mContext,appDiff.mPkgInfo);
  if (appDiff.mInstalledAppInfo != null) {
    return perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW);
  }
  return perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL);
}

Fixed version (ground truth):
private int newPermissionCount(Apk apk){
  AppDiff appDiff=new AppDiff(context.getPackageManager(),apk);
  if (appDiff.mPkgInfo == null) {
    throw new RuntimeException("String_Node_Str");
  }
  AppSecurityPermissions perms=new AppSecurityPermissions(context,appDiff.mPkgInfo);
  if (appDiff.mInstalledAppInfo != null) {
    return perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW);
  }
  return perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL);
}
Program: 165245
Project: 165245
Buggy source:
Installer(Context context){
  this.mContext=context;
  this.mPm=context.getPackageManager();
  localBroadcastManager=LocalBroadcastManager.getInstance(context);
}

Fixed version (ground truth):
Installer(Context context){
  this.context=context;
  this.pm=context.getPackageManager();
  localBroadcastManager=LocalBroadcastManager.getInstance(context);
}
Program: 165246
Project: 165246
Buggy source:
public Intent getPermissionScreen(Apk apk){
  if (!isUnattended()) {
    return null;
  }
  int count=newPermissionCount(apk);
  if (count > 0) {
    Uri uri=ApkProvider.getContentUri(apk);
    Intent intent=new Intent(mContext,InstallConfirmActivity.class);
    intent.setData(uri);
    return intent;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Intent getPermissionScreen(Apk apk){
  if (!isUnattended()) {
    return null;
  }
  int count=newPermissionCount(apk);
  if (count > 0) {
    Uri uri=ApkProvider.getContentUri(apk);
    Intent intent=new Intent(context,InstallConfirmActivity.class);
    intent.setData(uri);
    return intent;
  }
 else {
    return null;
  }
}
Program: 165247
Project: 165247
Buggy source:
public Intent getUninstallScreen(String packageName){
  if (!isUnattended()) {
    return null;
  }
  Intent intent=new Intent(mContext,UninstallDialogActivity.class);
  intent.putExtra(Installer.EXTRA_PACKAGE_NAME,packageName);
  return intent;
}

Fixed version (ground truth):
public Intent getUninstallScreen(String packageName){
  if (!isUnattended()) {
    return null;
  }
  Intent intent=new Intent(context,UninstallDialogActivity.class);
  intent.putExtra(Installer.EXTRA_PACKAGE_NAME,packageName);
  return intent;
}
Program: 165248
Project: 165248
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  Utils.debugLog(TAG,"String_Node_Str");
  HandlerThread thread=new HandlerThread(TAG,Process.THREAD_PRIORITY_BACKGROUND);
  thread.start();
  serviceLooper=thread.getLooper();
  serviceHandler=new ServiceHandler(serviceLooper);
  localBroadcastManager=LocalBroadcastManager.getInstance(this);
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  Utils.debugLog(TAG,"String_Node_Str");
  HandlerThread thread=new HandlerThread(TAG,Process.THREAD_PRIORITY_BACKGROUND);
  thread.start();
  serviceLooper=thread.getLooper();
  serviceHandler=new ServiceHandler(serviceLooper);
}
Program: 165249
Project: 165249
Buggy source:
protected void handleIntent(Intent intent){
  String packageName=intent.getStringExtra(Installer.EXTRA_PACKAGE_NAME);
  installer=InstallerFactory.create(this,packageName);
switch (intent.getAction()) {
case ACTION_INSTALL:
{
      Uri uri=intent.getData();
      Uri originatingUri=intent.getParcelableExtra(Installer.EXTRA_ORIGINATING_URI);
      installer.installPackage(uri,originatingUri,packageName);
      break;
    }
case ACTION_UNINSTALL:
{
    installer.uninstallPackage(packageName);
    break;
  }
}
}

Fixed version (ground truth):
protected void handleIntent(Intent intent){
  String packageName=intent.getStringExtra(Installer.EXTRA_PACKAGE_NAME);
  Installer installer=InstallerFactory.create(this,packageName);
switch (intent.getAction()) {
case ACTION_INSTALL:
{
      Uri uri=intent.getData();
      Uri originatingUri=intent.getParcelableExtra(Installer.EXTRA_ORIGINATING_URI);
      installer.installPackage(uri,originatingUri,packageName);
      break;
    }
case ACTION_UNINSTALL:
{
    installer.uninstallPackage(packageName);
    break;
  }
}
}
Program: 165251
Project: 165251
Buggy source:
private HttpURLConnection getConnection() throws IOException {
  HttpURLConnection connection;
  if (isSwapUrl()) {
    connection=(HttpURLConnection)sourceUrl.openConnection();
  }
 else {
    connection=NetCipher.getHttpURLConnection(sourceUrl);
  }
  if (connection instanceof HttpsURLConnection && "String_Node_Str".equals(sourceUrl.getHost())) {
    ((HttpsURLConnection)connection).setSSLSocketFactory(HttpsURLConnection.getDefaultSSLSocketFactory());
  }
  if (username != null && password != null) {
    String authString=username + "String_Node_Str" + password;
    connection.setRequestProperty("String_Node_Str","String_Node_Str" + Base64.toBase64String(authString.getBytes()));
  }
  return connection;
}

Fixed version (ground truth):
private HttpURLConnection getConnection() throws IOException {
  HttpURLConnection connection;
  if (isSwapUrl()) {
    connection=(HttpURLConnection)sourceUrl.openConnection();
  }
 else {
    connection=NetCipher.getHttpURLConnection(sourceUrl);
  }
  if (connection instanceof HttpsURLConnection && !"String_Node_Str".equals(sourceUrl.getHost())) {
    ((HttpsURLConnection)connection).setSSLSocketFactory(HttpsURLConnection.getDefaultSSLSocketFactory());
  }
  if (username != null && password != null) {
    String authString=username + "String_Node_Str" + password;
    connection.setRequestProperty("String_Node_Str","String_Node_Str" + Base64.toBase64String(authString.getBytes()));
  }
  return connection;
}
Program: 165252
Project: 165252
Buggy source:
public Drawable loadGroupIcon(Context context,PackageManager pm){
  if (icon != 0) {
    return (Build.VERSION.SDK_INT < 22) ? loadIcon(pm) : loadUnbadgedIcon(pm);
  }
 else {
    return context.getDrawable(R.drawable.ic_perm_device_info);
  }
}

Fixed version (ground truth):
public Drawable loadGroupIcon(Context context,PackageManager pm){
  if (icon != 0) {
    return (Build.VERSION.SDK_INT < 22) ? loadIcon(pm) : loadUnbadgedIcon(pm);
  }
  return context.getDrawable(R.drawable.ic_perm_device_info);
}
Program: 165255
Project: 165255
Buggy source:
public AppSecurityPermissions(Context context,PackageInfo info){
  this(context);
  if (info == null) {
    return;
  }
  final Set<MyPermissionInfo> permSet=new HashSet<>();
  PackageInfo installedPkgInfo=null;
  if (info.requestedPermissions != null) {
    try {
      installedPkgInfo=mPm.getPackageInfo(info.packageName,PackageManager.GET_PERMISSIONS);
    }
 catch (    NameNotFoundException e) {
    }
    extractPerms(info,permSet,installedPkgInfo);
  }
  setPermissions(new ArrayList<>(permSet));
}

Fixed version (ground truth):
public AppSecurityPermissions(Context context,PackageInfo info){
  this(context);
  if (info == null) {
    return;
  }
  final Set<MyPermissionInfo> permSet=new HashSet<>();
  PackageInfo installedPkgInfo=null;
  if (info.requestedPermissions != null) {
    try {
      installedPkgInfo=mPm.getPackageInfo(info.packageName,PackageManager.GET_PERMISSIONS);
    }
 catch (    NameNotFoundException e) {
      throw new RuntimeException("String_Node_Str");
    }
    extractPerms(info,permSet,installedPkgInfo);
  }
  setPermissions(new ArrayList<>(permSet));
}
Program: 165256
Project: 165256
Buggy source:
@Override public int compareTo(Apk apk){
  return Integer.compare(vercode,apk.vercode);
}

Fixed version (ground truth):
@Override @TargetApi(19) public int compareTo(Apk apk){
  if (Build.VERSION.SDK_INT < 19) {
    return Integer.valueOf(vercode).compareTo(apk.vercode);
  }
  return Integer.compare(vercode,apk.vercode);
}
Program: 165257
Project: 165257
Buggy source:
/** 
 * Implement this method to provide authentication for the given connection.
 * @param connection the HTTP connection to authenticate
 */
public void authenticate(final HttpURLConnection connection);

Fixed version (ground truth):
/** 
 * Implement this method to provide authentication for the given connection.
 * @param connection the HTTP connection to authenticate
 */
void authenticate(final HttpURLConnection connection);
Program: 165259
Project: 165259
Buggy source:
@Override public Uri insert(Uri uri,ContentValues values){
  int code=matcher.match(uri);
  if (code == CODE_INIT) {
    initTable();
    return null;
  }
 else   if (code == CODE_COMMIT) {
    commitTable();
    return null;
  }
 else {
    return super.insert(uri,values);
  }
}

Fixed version (ground truth):
@Override public Uri insert(Uri uri,ContentValues values){
switch (matcher.match(uri)) {
case CODE_INIT:
    initTable();
  return null;
case CODE_COMMIT:
commitTable();
return null;
default :
return super.insert(uri,values);
}
}
Program: 165260
Project: 165260
Buggy source:
@Override public Uri insert(Uri uri,ContentValues values){
  int code=matcher.match(uri);
  if (code == CODE_INIT) {
    initTable();
    return null;
  }
 else   if (code == CODE_COMMIT) {
    updateAppDetails();
    commitTable();
    return null;
  }
 else {
    return super.insert(uri,values);
  }
}

Fixed version (ground truth):
@Override public Uri insert(Uri uri,ContentValues values){
switch (matcher.match(uri)) {
case CODE_INIT:
    initTable();
  return null;
case CODE_COMMIT:
updateAppDetails();
commitTable();
return null;
default :
return super.insert(uri,values);
}
}
Program: 165261
Project: 165261
Buggy source:
public void install(@NonNull final App app){
  final Apk apkToInstall=ApkProvider.Helper.find(this,app.id,app.suggestedVercode);
  final ApkDownloader downloader=new ApkDownloader(this,apkToInstall,apkToInstall.repoAddress);
  downloader.setProgressListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
switch (event.type) {
case ApkDownloader.EVENT_APK_DOWNLOAD_COMPLETE:
        handleDownloadComplete(downloader.localFile());
      break;
case ApkDownloader.EVENT_ERROR:
    break;
}
}
}
);
downloader.download();
}

Fixed version (ground truth):
public void install(@NonNull final App app){
  final Apk apkToInstall=ApkProvider.Helper.find(this,app.id,app.suggestedVercode);
  final ApkDownloader downloader=new ApkDownloader(this,app,apkToInstall,apkToInstall.repoAddress);
  downloader.setProgressListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
switch (event.type) {
case ApkDownloader.EVENT_APK_DOWNLOAD_COMPLETE:
        handleDownloadComplete(downloader.localFile());
      break;
case ApkDownloader.EVENT_ERROR:
    break;
}
}
}
);
downloader.download();
}
Program: 165262
Project: 165262
Buggy source:
public BluetoothConnection openConnection() throws IOException {
  BluetoothSocket socket=device.createInsecureRfcommSocketToServiceRecord(BluetoothConstants.fdroidUuid());
  BluetoothConnection connection=new BluetoothConnection(socket);
  connection.open();
  return connection;
}

Fixed version (ground truth):
public BluetoothConnection openConnection() throws IOException {
  BluetoothSocket socket=null;
  try {
    socket=device.createInsecureRfcommSocketToServiceRecord(BluetoothConstants.fdroidUuid());
    BluetoothConnection connection=new BluetoothConnection(socket);
    connection.open();
    return connection;
  }
 catch (  IOException e1) {
    Log.e(TAG,"String_Node_Str");
    Class<?> clazz=socket.getRemoteDevice().getClass();
    Class<?>[] paramTypes=new Class<?>[]{Integer.TYPE};
    Method method;
    try {
      method=clazz.getMethod("String_Node_Str",paramTypes);
      Object[] params=new Object[]{1};
      BluetoothSocket sockFallback=(BluetoothSocket)method.invoke(socket.getRemoteDevice(),params);
      BluetoothConnection connection=new BluetoothConnection(sockFallback);
      connection.open();
      return connection;
    }
 catch (    NoSuchMethodException e) {
      throw e1;
    }
catch (    IllegalAccessException e) {
      throw e1;
    }
catch (    InvocationTargetException e) {
      throw e1;
    }
  }
}
Program: 165263
Project: 165263
Buggy source:
public void onCreate(){
  super.onCreate();
  Preferences.get().unregisterLocalRepoBonjourListeners(bonjourEnabledListener);
  Preferences.get().registerLocalRepoHttpsListeners(httpsEnabledListener);
  LocalBroadcastManager.getInstance(this).registerReceiver(onWifiChange,new IntentFilter(WifiStateChangeService.BROADCAST));
}

Fixed version (ground truth):
public void onCreate(){
  super.onCreate();
  Log.d(TAG,"String_Node_Str");
  Preferences.get().registerLocalRepoBonjourListeners(bonjourEnabledListener);
  Preferences.get().registerLocalRepoHttpsListeners(httpsEnabledListener);
  LocalBroadcastManager.getInstance(this).registerReceiver(onWifiChange,new IntentFilter(WifiStateChangeService.BROADCAST));
}
Program: 165264
Project: 165264
Buggy source:
public void disableSwapping(){
  if (enabled) {
    new AsyncTask<Void,Void,Void>(){
      @Override protected Void doInBackground(      Void... params){
        disableSwappingSynchronous();
        return null;
      }
      @Override protected void onPostExecute(      Void aVoid){
        if (timer != null) {
          timer.cancel();
        }
        enabled=false;
      }
    }
.execute();
  }
}

Fixed version (ground truth):
public void disableSwapping(){
  if (enabled) {
    new AsyncTask<Void,Void,Void>(){
      @Override protected Void doInBackground(      Void... params){
        Log.d(TAG,"String_Node_Str");
        disableSwappingSynchronous();
        return null;
      }
      @Override protected void onPostExecute(      Void aVoid){
        Log.d(TAG,"String_Node_Str");
        if (timer != null) {
          timer.cancel();
        }
        enabled=false;
        Log.d(TAG,"String_Node_Str");
        stopForeground(true);
      }
    }
.execute();
  }
}
Program: 165265
Project: 165265
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  disableSwapping();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  Log.d(TAG,"String_Node_Str");
  disableSwapping();
  Preferences.get().unregisterLocalRepoBonjourListeners(bonjourEnabledListener);
  Preferences.get().unregisterLocalRepoHttpsListeners(httpsEnabledListener);
  LocalBroadcastManager.getInstance(this).unregisterReceiver(onWifiChange);
}
Program: 165266
Project: 165266
Buggy source:
/** 
 * The guts of this class - responsible for enabling the relevant services for swapping. * Doesn't know anything about enabled/disabled. * Runs synchronously on the thread it was called.
 */
private void enableSwappingSynchronous(){
  nfcType.start();
  webServerType.start();
  bonjourType.start();
  startForeground(NOTIFICATION,createNotification());
}

Fixed version (ground truth):
/** 
 * The guts of this class - responsible for enabling the relevant services for swapping. * Doesn't know anything about enabled/disabled. * Runs synchronously on the thread it was called.
 */
private void enableSwappingSynchronous(){
  nfcType.start();
  webServerType.start();
  bonjourType.start();
}
Program: 165267
Project: 165267
Buggy source:
/** 
 * @see SwapService#enableSwappingSynchronous()
 */
private void disableSwappingSynchronous(){
  bonjourType.stop();
  webServerType.stop();
  nfcType.stop();
  stopForeground(true);
}

Fixed version (ground truth):
/** 
 * @see SwapService#enableSwappingSynchronous()
 */
private void disableSwappingSynchronous(){
  Log.d(TAG,"String_Node_Str");
  bonjourType.stop();
  webServerType.stop();
  nfcType.stop();
}
Program: 165268
Project: 165268
Buggy source:
@Override public void run(){
  disableSwapping();
}

Fixed version (ground truth):
@Override public void run(){
  Log.d(TAG,"String_Node_Str" + TIMEOUT + "String_Node_Str");
  disableSwapping();
}
Program: 165269
Project: 165269
Buggy source:
public void restartIfEnabled(){
  if (enabled) {
    new AsyncTask<Void,Void,Void>(){
      @Override protected Void doInBackground(      Void... params){
        disableSwappingSynchronous();
        enableSwappingSynchronous();
        return null;
      }
    }
.execute();
  }
}

Fixed version (ground truth):
public void restartIfEnabled(){
  if (enabled) {
    new AsyncTask<Void,Void,Void>(){
      @Override protected Void doInBackground(      Void... params){
        Log.d(TAG,"String_Node_Str");
        disableSwappingSynchronous();
        enableSwappingSynchronous();
        return null;
      }
    }
.execute();
  }
}
Program: 165270
Project: 165270
Buggy source:
private void initTimer(){
  if (timer != null)   timer.cancel();
  timer=new Timer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      disableSwapping();
    }
  }
,TIMEOUT);
}

Fixed version (ground truth):
private void initTimer(){
  if (timer != null) {
    Log.d(TAG,"String_Node_Str");
    timer.cancel();
  }
  Log.d(TAG,"String_Node_Str");
  timer=new Timer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      Log.d(TAG,"String_Node_Str" + TIMEOUT + "String_Node_Str");
      disableSwapping();
    }
  }
,TIMEOUT);
}
Program: 165271
Project: 165271
Buggy source:
@Override protected Void doInBackground(Void... params){
  disableSwappingSynchronous();
  enableSwappingSynchronous();
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... params){
  Log.d(TAG,"String_Node_Str");
  disableSwappingSynchronous();
  enableSwappingSynchronous();
  return null;
}
Program: 165272
Project: 165272
Buggy source:
/** 
 * Ensures that the webserver is running, as are the other services which make swap work. Will only do all this if it is not already running, and will run on a background thread.' TODO: What about an "enabling" status? Not sure if it will be useful or not.
 */
public void enableSwapping(){
  if (!enabled) {
    new AsyncTask<Void,Void,Void>(){
      @Override protected Void doInBackground(      Void... params){
        enableSwappingSynchronous();
        return null;
      }
      @Override protected void onPostExecute(      Void aVoid){
        enabled=true;
      }
    }
.execute();
  }
  initTimer();
}

Fixed version (ground truth):
/** 
 * Ensures that the webserver is running, as are the other services which make swap work. Will only do all this if it is not already running, and will run on a background thread.' TODO: What about an "enabling" status? Not sure if it will be useful or not.
 */
public void enableSwapping(){
  if (!enabled) {
    new AsyncTask<Void,Void,Void>(){
      @Override protected Void doInBackground(      Void... params){
        Log.d(TAG,"String_Node_Str");
        enableSwappingSynchronous();
        return null;
      }
      @Override protected void onPostExecute(      Void aVoid){
        Log.d(TAG,"String_Node_Str");
        startForeground(NOTIFICATION,createNotification());
        enabled=true;
      }
    }
.execute();
  }
  initTimer();
}
Program: 165273
Project: 165273
Buggy source:
@Override protected void onPostExecute(Void aVoid){
  if (timer != null) {
    timer.cancel();
  }
  enabled=false;
}

Fixed version (ground truth):
@Override protected void onPostExecute(Void aVoid){
  Log.d(TAG,"String_Node_Str");
  if (timer != null) {
    timer.cancel();
  }
  enabled=false;
  Log.d(TAG,"String_Node_Str");
  stopForeground(true);
}
Program: 165274
Project: 165274
Buggy source:
@Override public void start(){
  if (Preferences.get().isLocalRepoBonjourEnabled())   return;
  if (pairService != null || jmdns != null)   clearCurrentMDNSService();
  String repoName=Preferences.get().getLocalRepoName();
  HashMap<String,String> values=new HashMap<>();
  values.put("String_Node_Str","String_Node_Str");
  values.put("String_Node_Str",repoName);
  values.put("String_Node_Str",FDroidApp.repo.fingerprint);
  String type;
  if (Preferences.get().isLocalRepoHttpsEnabled()) {
    values.put("String_Node_Str","String_Node_Str");
    type="String_Node_Str";
  }
 else {
    values.put("String_Node_Str","String_Node_Str");
    type="String_Node_Str";
  }
  try {
    pairService=ServiceInfo.create(type,repoName,FDroidApp.port,0,0,values);
    jmdns=JmDNS.create();
    jmdns.registerService(pairService);
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
    Log.e(TAG,Log.getStackTraceString(e));
  }
}

Fixed version (ground truth):
@Override public void start(){
  if (Preferences.get().isLocalRepoBonjourEnabled())   return;
  if (pairService != null || jmdns != null)   clearCurrentMDNSService();
  String repoName=Preferences.get().getLocalRepoName();
  HashMap<String,String> values=new HashMap<>();
  values.put("String_Node_Str","String_Node_Str");
  values.put("String_Node_Str",repoName);
  values.put("String_Node_Str",FDroidApp.repo.fingerprint);
  String type;
  if (Preferences.get().isLocalRepoHttpsEnabled()) {
    values.put("String_Node_Str","String_Node_Str");
    type="String_Node_Str";
  }
 else {
    values.put("String_Node_Str","String_Node_Str");
    type="String_Node_Str";
  }
  try {
    Log.d(TAG,"String_Node_Str");
    pairService=ServiceInfo.create(type,repoName,FDroidApp.port,0,0,values);
    jmdns=JmDNS.create();
    jmdns.registerService(pairService);
    Log.d(TAG,"String_Node_Str");
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
    Log.e(TAG,Log.getStackTraceString(e));
  }
}
Program: 165275
Project: 165275
Buggy source:
@Override public void stop(){
  if (webServerThreadHandler == null) {
    Log.i(TAG,"String_Node_Str");
    return;
  }
  Message msg=webServerThreadHandler.obtainMessage();
  msg.obj=webServerThreadHandler.getLooper().getThread().getName() + "String_Node_Str";
  webServerThreadHandler.sendMessage(msg);
}

Fixed version (ground truth):
@Override public void stop(){
  if (webServerThreadHandler == null) {
    Log.i(TAG,"String_Node_Str");
    return;
  }
  Log.d(TAG,"String_Node_Str");
  Message msg=webServerThreadHandler.obtainMessage();
  msg.obj=webServerThreadHandler.getLooper().getThread().getName() + "String_Node_Str";
  webServerThreadHandler.sendMessage(msg);
}
Program: 165276
Project: 165276
Buggy source:
/** 
 * The most preferred ABI is the first element in the list.
 */
@SuppressWarnings("String_Node_Str") public static String[] getAbis(){
  if (hasApi(21)) {
    return new String[]{Build.CPU_ABI};
  }
  if (hasApi(8)) {
    return new String[]{Build.CPU_ABI,Build.CPU_ABI2};
  }
  return Build.SUPPORTED_ABIS;
}

Fixed version (ground truth):
/** 
 * The most preferred ABI is the first element in the list.
 */
@SuppressWarnings("String_Node_Str") public static String[] getAbis(){
  if (hasApi(21)) {
    return Build.SUPPORTED_ABIS;
  }
  if (hasApi(8)) {
    return new String[]{Build.CPU_ABI,Build.CPU_ABI2};
  }
  return new String[]{Build.CPU_ABI};
}
Program: 165278
Project: 165278
Buggy source:
private Shell.Builder createShellBuilder(){
  Shell.Builder shellBuilder=new Shell.Builder().useSU().setWantSTDERR(true).setWatchdogTimeout(5).setMinimalLogging(true);
  return shellBuilder;
}

Fixed version (ground truth):
private Shell.Builder createShellBuilder(){
  Shell.Builder shellBuilder=new Shell.Builder().useSU().setWantSTDERR(true).setWatchdogTimeout(30).setMinimalLogging(false);
  return shellBuilder;
}
Program: 165279
Project: 165279
Buggy source:
@Override public void run(){
  setProgressBarIndeterminateVisibility(false);
  Log.e(TAG,"String_Node_Str" + errorCode);
  AlertDialog.Builder alertBuilder=new AlertDialog.Builder(AppDetails.this);
  alertBuilder.setTitle(R.string.installer_error_title);
  alertBuilder.setMessage(R.string.installer_error_title);
  alertBuilder.setNeutralButton(android.R.string.ok,null);
  alertBuilder.create().show();
}

Fixed version (ground truth):
@Override public void run(){
  setSupportProgressBarIndeterminateVisibility(false);
  myAppObserver.onChange();
  Log.e(TAG,"String_Node_Str" + errorCode);
  AlertDialog.Builder alertBuilder=new AlertDialog.Builder(AppDetails.this);
  alertBuilder.setTitle(R.string.installer_error_title);
  alertBuilder.setMessage(R.string.installer_error_title);
  alertBuilder.setNeutralButton(android.R.string.ok,null);
  alertBuilder.create().show();
}
Program: 165280
Project: 165280
Buggy source:
@Override public void removeApk(String packageName){
  setProgressBarIndeterminateVisibility(true);
  try {
    installer.deletePackage(packageName);
  }
 catch (  AndroidNotCompatibleException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void removeApk(String packageName){
  setSupportProgressBarIndeterminateVisibility(true);
  try {
    installer.deletePackage(packageName);
  }
 catch (  AndroidNotCompatibleException e) {
    Log.e(TAG,"String_Node_Str",e);
    setSupportProgressBarIndeterminateVisibility(false);
  }
}
Program: 165281
Project: 165281
Buggy source:
@Override public void onChange(boolean selfChange,Uri uri){
  if (!reset(app.id)) {
    AppDetails.this.finish();
    return;
  }
  refreshApkList();
  supportInvalidateOptionsMenu();
}

Fixed version (ground truth):
public void onChange(){
  if (!reset(app.id)) {
    AppDetails.this.finish();
    return;
  }
  refreshApkList();
  supportInvalidateOptionsMenu();
}
Program: 165282
Project: 165282
Buggy source:
/** 
 * Once the download completes successfully, call this method to start the install process with the file that was downloaded.
 */
private void downloadCompleteInstallApk(){
}

Fixed version (ground truth):
/** 
 * Once the download completes successfully, call this method to start the install process with the file that was downloaded.
 */
private void downloadCompleteInstallApk(){
  if (downloadHandler != null) {
    installApk(downloadHandler.localFile(),downloadHandler.getApk().id);
    cleanUpFinishedDownload();
  }
}
Program: 165283
Project: 165283
Buggy source:
private void installApk(File file,String packageName){
  setProgressBarIndeterminateVisibility(true);
  try {
    installer.installPackage(file);
  }
 catch (  AndroidNotCompatibleException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void installApk(File file,String packageName){
  setSupportProgressBarIndeterminateVisibility(true);
  try {
    installer.installPackage(file);
  }
 catch (  AndroidNotCompatibleException e) {
    Log.e(TAG,"String_Node_Str",e);
    setSupportProgressBarIndeterminateVisibility(false);
  }
}
Program: 165284
Project: 165284
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  fdroidApp=((FDroidApp)getApplication());
  fdroidApp.applyTheme(this);
  super.onCreate(savedInstanceState);
  if (getIntent().hasExtra(EXTRA_FROM)) {
    setTitle(getIntent().getStringExtra(EXTRA_FROM));
  }
  mPm=getPackageManager();
  installer=Installer.getActivityInstaller(this,mPm,myInstallerCallback);
  ConfigurationChangeHelper previousData=(ConfigurationChangeHelper)getLastCustomNonConfigurationInstance();
  if (previousData != null) {
    Log.d(TAG,"String_Node_Str");
    downloadHandler=previousData.downloader;
    if (downloadHandler != null) {
      Log.d(TAG,"String_Node_Str");
    }
    app=previousData.app;
    setApp(app);
  }
 else {
    if (!reset(getAppIdFromIntent())) {
      finish();
      return;
    }
  }
  adapter=new ApkListAdapter(this,app);
  setContentView(R.layout.app_details);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  View onlyInLandscape=findViewById(R.id.app_summary_container);
  AppDetailsListFragment listFragment=(AppDetailsListFragment)getSupportFragmentManager().findFragmentById(R.id.fragment_app_list);
  if (onlyInLandscape == null) {
    listFragment.setupSummaryHeader();
  }
 else {
    listFragment.removeSummaryHeader();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  fdroidApp=((FDroidApp)getApplication());
  fdroidApp.applyTheme(this);
  super.onCreate(savedInstanceState);
  supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  if (getIntent().hasExtra(EXTRA_FROM)) {
    setTitle(getIntent().getStringExtra(EXTRA_FROM));
  }
  mPm=getPackageManager();
  installer=Installer.getActivityInstaller(this,mPm,myInstallerCallback);
  ConfigurationChangeHelper previousData=(ConfigurationChangeHelper)getLastCustomNonConfigurationInstance();
  if (previousData != null) {
    Log.d(TAG,"String_Node_Str");
    downloadHandler=previousData.downloader;
    if (downloadHandler != null) {
      Log.d(TAG,"String_Node_Str");
    }
    app=previousData.app;
    setApp(app);
  }
 else {
    if (!reset(getAppIdFromIntent())) {
      finish();
      return;
    }
  }
  adapter=new ApkListAdapter(this,app);
  setContentView(R.layout.app_details);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  View onlyInLandscape=findViewById(R.id.app_summary_container);
  AppDetailsListFragment listFragment=(AppDetailsListFragment)getSupportFragmentManager().findFragmentById(R.id.fragment_app_list);
  if (onlyInLandscape == null) {
    listFragment.setupSummaryHeader();
  }
 else {
    listFragment.removeSummaryHeader();
  }
  setSupportProgressBarIndeterminateVisibility(false);
}
Program: 165285
Project: 165285
Buggy source:
@Override public void onError(int operation,final int errorCode){
  if (errorCode == InstallerCallback.ERROR_CODE_CANCELED) {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        setProgressBarIndeterminateVisibility(false);
      }
    }
);
  }
 else {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        setProgressBarIndeterminateVisibility(false);
        Log.e(TAG,"String_Node_Str" + errorCode);
        AlertDialog.Builder alertBuilder=new AlertDialog.Builder(AppDetails.this);
        alertBuilder.setTitle(R.string.installer_error_title);
        alertBuilder.setMessage(R.string.installer_error_title);
        alertBuilder.setNeutralButton(android.R.string.ok,null);
        alertBuilder.create().show();
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onError(int operation,final int errorCode){
  if (errorCode == InstallerCallback.ERROR_CODE_CANCELED) {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        setSupportProgressBarIndeterminateVisibility(false);
        myAppObserver.onChange();
      }
    }
);
  }
 else {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        setSupportProgressBarIndeterminateVisibility(false);
        myAppObserver.onChange();
        Log.e(TAG,"String_Node_Str" + errorCode);
        AlertDialog.Builder alertBuilder=new AlertDialog.Builder(AppDetails.this);
        alertBuilder.setTitle(R.string.installer_error_title);
        alertBuilder.setMessage(R.string.installer_error_title);
        alertBuilder.setNeutralButton(android.R.string.ok,null);
        alertBuilder.create().show();
      }
    }
);
  }
}
Program: 165286
Project: 165286
Buggy source:
@Override public void onSuccess(final int operation){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      if (operation == Installer.InstallerCallback.OPERATION_INSTALL) {
        PackageManagerCompat.setInstaller(mPm,app.id);
      }
      setProgressBarIndeterminateVisibility(false);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onSuccess(final int operation){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      if (operation == Installer.InstallerCallback.OPERATION_INSTALL) {
        PackageManagerCompat.setInstaller(mPm,app.id);
      }
      setSupportProgressBarIndeterminateVisibility(false);
      myAppObserver.onChange();
    }
  }
);
}
Program: 165287
Project: 165287
Buggy source:
@Override protected void onReceiveResult(int resultCode,Bundle resultData){
  String message=resultData.getString(UpdateService.RESULT_MESSAGE);
  boolean finished=false;
  if (resultCode == UpdateService.STATUS_ERROR) {
    forwardEvent(EVENT_ERROR);
    Toast.makeText(context,message,Toast.LENGTH_LONG).show();
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_WITH_CHANGES) {
    forwardEvent(EVENT_COMPLETE_WITH_CHANGES);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_AND_SAME) {
    forwardEvent(EVENT_COMPLETE_AND_SAME);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_INFO) {
    forwardEvent(EVENT_INFO);
    dialog.setMessage(message);
  }
  if (finished && dialog.isShowing())   try {
    dialog.dismiss();
  }
 catch (  IllegalArgumentException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void onReceiveResult(int resultCode,Bundle resultData){
  String message=resultData.getString(UpdateService.RESULT_MESSAGE);
  boolean finished=false;
  if (resultCode == UpdateService.STATUS_ERROR) {
    forwardEvent(EVENT_ERROR);
    Toast.makeText(context,message,Toast.LENGTH_LONG).show();
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_WITH_CHANGES) {
    forwardEvent(EVENT_COMPLETE_WITH_CHANGES);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_AND_SAME) {
    forwardEvent(EVENT_COMPLETE_AND_SAME);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_INFO) {
    forwardEvent(EVENT_INFO);
    if (dialog != null) {
      lastShownMessage=message;
      dialog.setMessage(message);
    }
  }
  if (finished) {
    forwardEvent(EVENT_FINISHED);
    if (dialog.isShowing()) {
      try {
        dialog.dismiss();
      }
 catch (      IllegalArgumentException e) {
        e.printStackTrace();
      }
    }
  }
}