nus-yam/ex-repair huggingface dataset:
Program: 8287
Project: 8287
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.help_about_fragment,container,false);
  TextView versionText=(TextView)view.findViewById(R.id.help_about_version);
  versionText.setText(getString(R.string.help_about_version) + "String_Node_Str" + getVersion());
  HtmlTextView aboutTextView=(HtmlTextView)view.findViewById(R.id.help_about_text);
  try {
    String html=new Markdown4jProcessor().process(getActivity().getResources().openRawResource(R.raw.help_about));
    aboutTextView.setHtmlFromString(html,new HtmlTextView.LocalImageGetter());
  }
 catch (  IOException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
  }
  aboutTextView.setTextColor(getResources().getColor(android.R.color.black));
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.help_about_fragment,container,false);
  TextView versionText=(TextView)view.findViewById(R.id.help_about_version);
  versionText.setText(getString(R.string.help_about_version) + "String_Node_Str" + getVersion());
  HtmlTextView aboutTextView=(HtmlTextView)view.findViewById(R.id.help_about_text);
  try {
    String html=new Markdown4jProcessor().process(getActivity().getResources().openRawResource(R.raw.help_about));
    aboutTextView.setHtmlFromString(html,new HtmlTextView.LocalImageGetter());
  }
 catch (  IOException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
  }
  return view;
}
Program: 8288
Project: 8288
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  int mHtmlFile=getArguments().getInt(ARG_MARKDOWN_RES);
  ScrollView scroller=new ScrollView(getActivity());
  HtmlTextView text=new HtmlTextView(getActivity());
  int padding=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,16,getActivity().getResources().getDisplayMetrics());
  text.setPadding(padding,padding,padding,0);
  scroller.addView(text);
  try {
    String html=new Markdown4jProcessor().process(getActivity().getResources().openRawResource(mHtmlFile));
    text.setHtmlFromString(html,new HtmlTextView.LocalImageGetter());
  }
 catch (  IOException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
  }
  text.setTextColor(getResources().getColor(android.R.color.black));
  return scroller;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  int mHtmlFile=getArguments().getInt(ARG_MARKDOWN_RES);
  ScrollView scroller=new ScrollView(getActivity());
  HtmlTextView text=new HtmlTextView(getActivity());
  int padding=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,16,getActivity().getResources().getDisplayMetrics());
  text.setPadding(padding,padding,padding,0);
  scroller.addView(text);
  try {
    String html=new Markdown4jProcessor().process(getActivity().getResources().openRawResource(mHtmlFile));
    text.setHtmlFromString(html,new HtmlTextView.LocalImageGetter());
  }
 catch (  IOException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
  }
  return scroller;
}
Program: 8289
Project: 8289
Buggy source:
private static void initializeTheme(final ListPreference mTheme){
  mTheme.setValue(sPreferences.getTheme());
  mTheme.setSummary(mTheme.getEntry());
  mTheme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference preference,    Object newValue){
      mTheme.setValue((String)newValue);
      mTheme.setSummary(mTheme.getEntry());
      sPreferences.setTheme((String)newValue);
      return false;
    }
  }
);
}

Fixed version (ground truth):
private static void initializeTheme(final ListPreference mTheme){
  mTheme.setValue(sPreferences.getTheme());
  mTheme.setSummary(mTheme.getEntry());
  mTheme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference preference,    Object newValue){
      mTheme.setValue((String)newValue);
      mTheme.setSummary(mTheme.getEntry());
      sPreferences.setTheme((String)newValue);
      ((SettingsActivity)mTheme.getContext()).recreate();
      return false;
    }
  }
);
}
Program: 8290
Project: 8290
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (mThemeChanger.changeTheme()) {
    Intent intent=getIntent();
    finish();
    startActivity(intent);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (mThemeChanger.changeTheme()) {
    Intent intent=getIntent();
    finish();
    overridePendingTransition(0,0);
    startActivity(intent);
    overridePendingTransition(0,0);
  }
}
Program: 8291
Project: 8291
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  mThemeChanger=new ThemeChanger(this);
  mThemeChanger.changeTheme();
  super.onCreate(savedInstanceState);
  initLayout();
  initToolbar();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  initTheme();
  super.onCreate(savedInstanceState);
  initLayout();
  initToolbar();
}
Program: 8292
Project: 8292
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (mThemeChanger.changeTheme()) {
    Intent intent=getIntent();
    finish();
    startActivity(intent);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (mThemeChanger.changeTheme()) {
    Intent intent=getIntent();
    finish();
    overridePendingTransition(0,0);
    startActivity(intent);
    overridePendingTransition(0,0);
  }
}
Program: 8293
Project: 8293
Buggy source:
public ThemeChanger(Context context){
  mContext=context;
  mPreferences=Preferences.getPreferences(mContext);
}

Fixed version (ground truth):
public ThemeChanger(Activity context){
  mContext=context;
  mPreferences=Preferences.getPreferences(mContext);
}
Program: 8294
Project: 8294
Buggy source:
/** 
 * Apply the theme set in preferences if it isn't equal to mCurrentTheme anymore or mCurrentTheme hasn't been set yet. If a new theme is applied in this method, then return true, so the caller can re-create the activity, if need be.
 */
public boolean changeTheme(){
  String newTheme=mPreferences.getTheme();
  if (mCurrentTheme != null && mCurrentTheme.equals(newTheme)) {
    return false;
  }
  int themeId=R.style.Theme_Keychain_Light;
  if (Constants.Pref.Theme.DARK.equals(newTheme)) {
    themeId=R.style.Theme_Keychain_Dark;
  }
  ContextThemeWrapper w=new ContextThemeWrapper(mContext,themeId);
  mContext.getTheme().setTo(w.getTheme());
  mCurrentTheme=newTheme;
  return true;
}

Fixed version (ground truth):
/** 
 * Apply the theme set in preferences if it isn't equal to mCurrentTheme anymore or mCurrentTheme hasn't been set yet. If a new theme is applied in this method, then return true, so the caller can re-create the activity, if need be.
 */
public boolean changeTheme(){
  String newTheme=mPreferences.getTheme();
  if (mCurrentTheme != null && mCurrentTheme.equals(newTheme)) {
    return false;
  }
  int themeId=mLightResId;
  if (Constants.Pref.Theme.DARK.equals(newTheme)) {
    themeId=mDarkResId;
  }
  ContextThemeWrapper w=new ContextThemeWrapper(mContext,themeId);
  mContext.getTheme().setTo(w.getTheme());
  mCurrentTheme=newTheme;
  return true;
}
Program: 8296
Project: 8296
Buggy source:
private CryptoOperationHelper.Callback<DeleteKeyringParcel,DeleteResult> getDeletionCallback(){
  return new CryptoOperationHelper.Callback<DeleteKeyringParcel,DeleteResult>(){
    @Override public DeleteKeyringParcel createOperationInput(){
      return new DeleteKeyringParcel(mMasterKeyIds,true);
    }
    @Override public void onCryptoOperationSuccess(    DeleteResult result){
      returnResult(result);
    }
    @Override public void onCryptoOperationCancelled(){
      setResult(RESULT_CANCELED);
      finish();
    }
    @Override public void onCryptoOperationError(    DeleteResult result){
      returnResult(result);
    }
    @Override public boolean onCryptoSetProgress(    String msg,    int progress,    int max){
      return false;
    }
  }
;
}

Fixed version (ground truth):
private CryptoOperationHelper.Callback<DeleteKeyringParcel,DeleteResult> getDeletionCallback(){
  return new CryptoOperationHelper.Callback<DeleteKeyringParcel,DeleteResult>(){
    @Override public DeleteKeyringParcel createOperationInput(){
      return new DeleteKeyringParcel(mMasterKeyIds,mHasSecret);
    }
    @Override public void onCryptoOperationSuccess(    DeleteResult result){
      returnResult(result);
    }
    @Override public void onCryptoOperationCancelled(){
      setResult(RESULT_CANCELED);
      finish();
    }
    @Override public void onCryptoOperationError(    DeleteResult result){
      returnResult(result);
    }
    @Override public boolean onCryptoSetProgress(    String msg,    int progress,    int max){
      return false;
    }
  }
;
}
Program: 8298
Project: 8298
Buggy source:
@Override public DeleteKeyringParcel createOperationInput(){
  return new DeleteKeyringParcel(mMasterKeyIds,true);
}

Fixed version (ground truth):
@Override public DeleteKeyringParcel createOperationInput(){
  return new DeleteKeyringParcel(mMasterKeyIds,mHasSecret);
}
Program: 8299
Project: 8299
Buggy source:
private void showNormalDeleteDialog(){
  DeleteKeyDialogFragment deleteKeyDialogFragment=DeleteKeyDialogFragment.newInstance(mMasterKeyIds);
  deleteKeyDialogFragment.show(getSupportFragmentManager(),"String_Node_Str");
}

Fixed version (ground truth):
private void showNormalDeleteDialog(){
  DeleteKeyDialogFragment deleteKeyDialogFragment=DeleteKeyDialogFragment.newInstance(mMasterKeyIds,mHasSecret);
  deleteKeyDialogFragment.show(getSupportFragmentManager(),"String_Node_Str");
}
Program: 8300
Project: 8300
Buggy source:
/** 
 * Show dialog to delete key
 * @param hasSecret must contain whether the list of masterKeyIds contains a secret key or not
 */
public void showDeleteKeyDialog(long[] masterKeyIds,boolean hasSecret){
  if (hasSecret && masterKeyIds.length > 1) {
    Notify.create(getActivity(),R.string.secret_cannot_multiple,Notify.Style.ERROR).show();
    return;
  }
  Intent intent=new Intent(getActivity(),DeleteKeyDialogActivity.class);
  intent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS,masterKeyIds);
  intent.putExtra(DeleteKeyDialogActivity.EXTRA_HAS_SECRET,hasSecret);
  if (hasSecret) {
    intent.putExtra(DeleteKeyDialogActivity.EXTRA_KEYSERVER,Preferences.getPreferences(getActivity()).getPreferredKeyserver());
  }
  startActivityForResult(intent,REQUEST_DELETE);
}

Fixed version (ground truth):
/** 
 * Show dialog to delete key
 * @param hasSecret must contain whether the list of masterKeyIds contains a secret key or not
 */
public void showDeleteKeyDialog(long[] masterKeyIds,boolean hasSecret){
  Intent intent=new Intent(getActivity(),DeleteKeyDialogActivity.class);
  intent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS,masterKeyIds);
  intent.putExtra(DeleteKeyDialogActivity.EXTRA_HAS_SECRET,hasSecret);
  if (hasSecret) {
    intent.putExtra(DeleteKeyDialogActivity.EXTRA_KEYSERVER,Preferences.getPreferences(getActivity()).getPreferredKeyserver());
  }
  startActivityForResult(intent,REQUEST_DELETE);
}
Program: 8303
Project: 8303
Buggy source:
private void decryptFromClipboard(){
  Activity activity=getActivity();
  if (activity == null) {
    return;
  }
  final CharSequence clipboardText=ClipboardReflection.getClipboardText(activity);
  if (clipboardText == null) {
    Notify.create(activity,R.string.error_clipboard_empty,Style.ERROR);
  }
  Intent clipboardDecrypt=new Intent(getActivity(),DecryptActivity.class);
  clipboardDecrypt.setAction(DecryptActivity.ACTION_DECRYPT_FROM_CLIPBOARD);
  startActivityForResult(clipboardDecrypt,0);
}

Fixed version (ground truth):
private void decryptFromClipboard(){
  Activity activity=getActivity();
  if (activity == null) {
    return;
  }
  final CharSequence clipboardText=ClipboardReflection.getClipboardText(activity);
  if (clipboardText == null || TextUtils.isEmpty(clipboardText)) {
    Notify.create(activity,R.string.error_clipboard_empty,Style.ERROR).show();
    return;
  }
  Intent clipboardDecrypt=new Intent(getActivity(),DecryptActivity.class);
  clipboardDecrypt.setAction(DecryptActivity.ACTION_DECRYPT_FROM_CLIPBOARD);
  startActivityForResult(clipboardDecrypt,0);
}
Program: 8304
Project: 8304
Buggy source:
public boolean containsSubkey(String expectedFingerprint){
  Iterator<PGPPublicKey> it=mRing.getPublicKeys();
  while (it.hasNext()) {
    if (KeyFormattingUtils.convertFingerprintToHex(it.next().getFingerprint()).equals(expectedFingerprint)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean containsSubkey(String expectedFingerprint){
  Iterator<PGPPublicKey> it=mRing.getPublicKeys();
  while (it.hasNext()) {
    if (KeyFormattingUtils.convertFingerprintToHex(it.next().getFingerprint()).equalsIgnoreCase(expectedFingerprint)) {
      return true;
    }
  }
  return false;
}
Program: 8306
Project: 8306
Buggy source:
protected void onCryptoOperationError(S result){
  result.createNotify(getActivity()).show(this);
}

Fixed version (ground truth):
protected void onCryptoOperationError(S result){
  result.createNotify(getActivity()).show();
}
Program: 8313
Project: 8313
Buggy source:
private boolean onEnDecryptSelected(){
  mToolbar.setTitle(R.string.nav_encrypt_decrypt);
  clearFragments();
  if (mEncryptDecryptOverviewFragment == null) {
    mEncryptDecryptOverviewFragment=new EncryptDecryptOverviewFragment();
  }
  setFragment(mEncryptDecryptOverviewFragment);
  return true;
}

Fixed version (ground truth):
private void onEnDecryptSelected(){
  mToolbar.setTitle(R.string.nav_encrypt_decrypt);
  Fragment frag=new EncryptDecryptOverviewFragment();
  setFragment(frag,true);
}
Program: 8314
Project: 8314
Buggy source:
private void setFragment(Fragment fragment,boolean addToBackStack){
  this.mLastUsedFragment=fragment;
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  ft.replace(R.id.main_fragment_container,fragment);
  if (addToBackStack) {
    ft.addToBackStack(null);
  }
  ft.commit();
}

Fixed version (ground truth):
private void setFragment(Fragment fragment,boolean addToBackStack){
  FragmentManager fragmentManager=getSupportFragmentManager();
  fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  FragmentTransaction ft=fragmentManager.beginTransaction();
  ft.replace(R.id.main_fragment_container,fragment);
  if (addToBackStack) {
    ft.addToBackStack(null);
  }
  ft.commit();
}
Program: 8315
Project: 8315
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  outState=result.saveInstanceState(outState);
  super.onSaveInstanceState(outState);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  outState=mDrawerResult.saveInstanceState(outState);
  super.onSaveInstanceState(outState);
}
Program: 8316
Project: 8316
Buggy source:
private boolean onAppsSelected(){
  mToolbar.setTitle(R.string.nav_apps);
  clearFragments();
  if (mAppsListFragment == null) {
    mAppsListFragment=new AppsListFragment();
  }
  setFragment(mAppsListFragment);
  return true;
}

Fixed version (ground truth):
private void onAppsSelected(){
  mToolbar.setTitle(R.string.nav_apps);
  Fragment frag=new AppsListFragment();
  setFragment(frag,true);
}
Program: 8317
Project: 8317
Buggy source:
private boolean onKeysSelected(){
  mToolbar.setTitle(R.string.app_name);
  clearFragments();
  if (mKeyListFragment == null) {
    mKeyListFragment=new KeyListFragment();
  }
  setFragment(mKeyListFragment,false);
  return true;
}

Fixed version (ground truth):
private void onKeysSelected(){
  mToolbar.setTitle(R.string.app_name);
  Fragment frag=new KeyListFragment();
  setFragment(frag,false);
}
Program: 8318
Project: 8318
Buggy source:
@Override public void onBackPressed(){
  if (result != null && result.isDrawerOpen()) {
    result.closeDrawer();
  }
 else {
    super.onBackPressed();
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (mDrawerResult != null && mDrawerResult.isDrawerOpen()) {
    mDrawerResult.closeDrawer();
  }
 else {
    super.onBackPressed();
  }
}
Program: 8320
Project: 8320
Buggy source:
private boolean onEnDecryptSelected(){
  mToolbar.setTitle(R.string.nav_encrypt_decrypt);
  clearFragments();
  if (mEncryptDecryptOverviewFragment == null) {
    mEncryptDecryptOverviewFragment=new EncryptDecryptOverviewFragment();
  }
  setFragment(mEncryptDecryptOverviewFragment);
  return true;
}

Fixed version (ground truth):
private void onEnDecryptSelected(){
  mToolbar.setTitle(R.string.nav_encrypt_decrypt);
  Fragment frag=new EncryptDecryptOverviewFragment();
  setFragment(frag,true);
}
Program: 8321
Project: 8321
Buggy source:
private void setFragment(Fragment fragment,boolean addToBackStack){
  this.mLastUsedFragment=fragment;
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  ft.replace(R.id.main_fragment_container,fragment);
  if (addToBackStack) {
    ft.addToBackStack(null);
  }
  ft.commit();
}

Fixed version (ground truth):
private void setFragment(Fragment fragment,boolean addToBackStack){
  FragmentManager fragmentManager=getSupportFragmentManager();
  fragmentManager.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  FragmentTransaction ft=fragmentManager.beginTransaction();
  ft.replace(R.id.main_fragment_container,fragment);
  if (addToBackStack) {
    ft.addToBackStack(null);
  }
  ft.commit();
}
Program: 8322
Project: 8322
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  outState=result.saveInstanceState(outState);
  super.onSaveInstanceState(outState);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  outState=mDrawerResult.saveInstanceState(outState);
  super.onSaveInstanceState(outState);
}
Program: 8323
Project: 8323
Buggy source:
private boolean onAppsSelected(){
  mToolbar.setTitle(R.string.nav_apps);
  clearFragments();
  if (mAppsListFragment == null) {
    mAppsListFragment=new AppsListFragment();
  }
  setFragment(mAppsListFragment);
  return true;
}

Fixed version (ground truth):
private void onAppsSelected(){
  mToolbar.setTitle(R.string.nav_apps);
  Fragment frag=new AppsListFragment();
  setFragment(frag,true);
}
Program: 8324
Project: 8324
Buggy source:
private boolean onKeysSelected(){
  mToolbar.setTitle(R.string.app_name);
  clearFragments();
  if (mKeyListFragment == null) {
    mKeyListFragment=new KeyListFragment();
  }
  setFragment(mKeyListFragment,false);
  return true;
}

Fixed version (ground truth):
private void onKeysSelected(){
  mToolbar.setTitle(R.string.app_name);
  Fragment frag=new KeyListFragment();
  setFragment(frag,false);
}
Program: 8325
Project: 8325
Buggy source:
@Override public void onBackPressed(){
  if (result != null && result.isDrawerOpen()) {
    result.closeDrawer();
  }
 else {
    super.onBackPressed();
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (mDrawerResult != null && mDrawerResult.isDrawerOpen()) {
    mDrawerResult.closeDrawer();
  }
 else {
    super.onBackPressed();
  }
}
Program: 8330
Project: 8330
Buggy source:
private static boolean checkSmartCardCompatibility(PGPSecretKey key,OperationLog log,int indent){
  PGPPublicKey publicKey=key.getPublicKey();
  int algorithm=publicKey.getAlgorithm();
  if (algorithm != PublicKeyAlgorithmTags.RSA_ENCRYPT && algorithm != PublicKeyAlgorithmTags.RSA_SIGN && algorithm != PublicKeyAlgorithmTags.RSA_GENERAL) {
    log.add(OperationResult.LogType.MSG_K2C_ERROR_BAD_ALGO,indent + 1);
    return true;
  }
  int keySize=publicKey.getBitStrength();
  if (keySize != 2048) {
    log.add(OperationResult.LogType.MSG_K2C_ERROR_BAD_SIZE,indent + 1);
    return false;
  }
  if (isDivertToCard(key) || isDummy(key)) {
    log.add(OperationResult.LogType.MSG_K2C_ERROR_BAD_STRIPPED,indent + 1);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private static boolean checkSmartCardCompatibility(PGPSecretKey key,OperationLog log,int indent){
  PGPPublicKey publicKey=key.getPublicKey();
  int algorithm=publicKey.getAlgorithm();
  if (algorithm != PublicKeyAlgorithmTags.RSA_ENCRYPT && algorithm != PublicKeyAlgorithmTags.RSA_SIGN && algorithm != PublicKeyAlgorithmTags.RSA_GENERAL) {
    log.add(LogType.MSG_MF_ERROR_BAD_NFC_ALGO,indent + 1);
    return false;
  }
  int keySize=publicKey.getBitStrength();
  if (keySize != 2048) {
    log.add(LogType.MSG_MF_ERROR_BAD_NFC_SIZE,indent + 1);
    return false;
  }
  if (isDivertToCard(key) || isDummy(key)) {
    log.add(LogType.MSG_MF_ERROR_BAD_NFC_STRIPPED,indent + 1);
    return false;
  }
  return true;
}
Program: 8333
Project: 8333
Buggy source:
@Override public void onClick(View v){
  launchContactActivity(finalContactId,context);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  launchContactActivity(contactId,context);
}
Program: 8334
Project: 8334
Buggy source:
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  setContentShown(false);
switch (id) {
case LOADER_ID_UNIFIED:
{
      Uri baseUri=KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
      return new CursorLoader(getActivity(),baseUri,UNIFIED_PROJECTION,null,null,null);
    }
case LOADER_ID_USER_IDS:
  return UserIdsAdapter.createLoader(getActivity(),mDataUri);
default :
return null;
}
}

Fixed version (ground truth):
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  setContentShown(false);
switch (id) {
case LOADER_ID_UNIFIED:
{
      Uri baseUri=KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
      return new CursorLoader(getActivity(),baseUri,UNIFIED_PROJECTION,null,null,null);
    }
case LOADER_ID_USER_IDS:
  return UserIdsAdapter.createLoader(getActivity(),mDataUri);
case LOADER_ID_LINKED_CONTACT:
{
  long masterKeyId=args.getLong(LOADER_LINKED_CONTACT_MASTER_KEY_ID);
  boolean isSecret=args.getBoolean(LOADER_LINKED_CONTACT_IS_SECRET);
  Uri baseUri;
  if (isSecret)   baseUri=ContactsContract.Profile.CONTENT_RAW_CONTACTS_URI;
 else   baseUri=ContactsContract.RawContacts.CONTENT_URI;
  return new CursorLoader(getActivity(),baseUri,RAWCONTACT_PROJECTION,ContactsContract.RawContacts.ACCOUNT_TYPE + "String_Node_Str" + ContactsContract.RawContacts.SOURCE_ID+ "String_Node_Str"+ ContactsContract.RawContacts.DELETED+ "String_Node_Str",new String[]{Constants.ACCOUNT_TYPE,Long.toString(masterKeyId),"String_Node_Str"},null);
}
default :
return null;
}
}
Program: 8335
Project: 8335
Buggy source:
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor data){
  if (data.getCount() == 0) {
    return;
  }
switch (loader.getId()) {
case LOADER_ID_UNIFIED:
{
      if (data.moveToFirst()) {
        mIsSecret=data.getInt(INDEX_HAS_ANY_SECRET) != 0;
        if (!mSystemContactLoaded) {
          long masterKeyId=data.getLong(INDEX_MASTER_KEY_ID);
          loadLinkedSystemContact(masterKeyId);
        }
        mUserIdsAdapter=new UserIdsAdapter(getActivity(),null,0,!mIsSecret,null);
        mUserIds.setAdapter(mUserIdsAdapter);
        getLoaderManager().initLoader(LOADER_ID_USER_IDS,null,this);
        break;
      }
    }
case LOADER_ID_USER_IDS:
{
    mUserIdsAdapter.swapCursor(data);
    break;
  }
}
setContentShown(true);
}

Fixed version (ground truth):
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor data){
  if (data.getCount() == 0) {
    return;
  }
switch (loader.getId()) {
case LOADER_ID_UNIFIED:
{
      if (data.moveToFirst()) {
        mIsSecret=data.getInt(INDEX_HAS_ANY_SECRET) != 0;
        mUserIdsAdapter=new UserIdsAdapter(getActivity(),null,0,!mIsSecret,null);
        mUserIds.setAdapter(mUserIdsAdapter);
        getLoaderManager().initLoader(LOADER_ID_USER_IDS,null,this);
        long masterKeyId=data.getLong(INDEX_MASTER_KEY_ID);
        long contactId=ContactHelper.findContactId(getActivity().getContentResolver(),masterKeyId);
        loadLinkedSystemContact(contactId);
        Bundle linkedContactData=new Bundle();
        linkedContactData.putLong(LOADER_LINKED_CONTACT_MASTER_KEY_ID,masterKeyId);
        linkedContactData.putBoolean(LOADER_LINKED_CONTACT_IS_SECRET,mIsSecret);
        getLoaderManager().initLoader(LOADER_ID_LINKED_CONTACT,linkedContactData,this);
        break;
      }
    }
case LOADER_ID_USER_IDS:
{
    mUserIdsAdapter.swapCursor(data);
    break;
  }
case LOADER_ID_LINKED_CONTACT:
{
  if (data.moveToFirst()) {
    long contactId=data.getLong(INDEX_CONTACT_ID);
    loadLinkedSystemContact(contactId);
  }
  break;
}
}
setContentShown(true);
}
Program: 8336
Project: 8336
Buggy source:
/** 
 * Checks if a system contact exists for given masterKeyId, and if it does, sets name, picture and onClickListener for the linked system contact's layout In the case of a secret key, "me" contact details are loaded
 * @param masterKeyId
 */
private void loadLinkedSystemContact(final long masterKeyId){
  final Context context=mSystemContactName.getContext();
  final ContentResolver resolver=context.getContentResolver();
  long contactId;
  String contactName=null;
  if (mIsSecret) {
    contactId=ContactHelper.getMainProfileContactId(resolver);
    List<String> mainProfileNames=ContactHelper.getMainProfileContactName(context);
    if (mainProfileNames != null && mainProfileNames.size() > 0) {
      contactName=mainProfileNames.get(0);
    }
  }
 else {
    contactId=ContactHelper.findContactId(resolver,masterKeyId);
    contactName=ContactHelper.getContactName(resolver,contactId);
  }
  if (contactName != null) {
    mSystemContactName.setText(contactName);
    Bitmap picture;
    if (mIsSecret) {
      picture=ContactHelper.loadMainProfilePhoto(resolver,false);
    }
 else {
      picture=ContactHelper.loadPhotoByMasterKeyId(resolver,masterKeyId,false);
    }
    if (picture != null)     mSystemContactPicture.setImageBitmap(picture);
    final long finalContactId=contactId;
    mSystemContactLayout.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        launchContactActivity(finalContactId,context);
      }
    }
);
    mSystemContactLoaded=true;
  }
}

Fixed version (ground truth):
/** 
 * Expects to be called only if a linked system contact exists. Sets name, picture and onClickListener for the linked system contact's layout. In the case of a secret key, "me" contact details are loaded.
 * @param contactId
 */
private void loadLinkedSystemContact(final long contactId){
  final Context context=mSystemContactName.getContext();
  final ContentResolver resolver=context.getContentResolver();
  String contactName=null;
  if (mIsSecret) {
    List<String> mainProfileNames=ContactHelper.getMainProfileContactName(context);
    if (mainProfileNames != null && mainProfileNames.size() > 0) {
      contactName=mainProfileNames.get(0);
    }
  }
 else {
    contactName=ContactHelper.getContactName(resolver,contactId);
  }
  if (contactName != null) {
    mSystemContactName.setText(contactName);
    Bitmap picture;
    if (mIsSecret) {
      picture=ContactHelper.loadMainProfilePhoto(resolver,false);
    }
 else {
      picture=ContactHelper.loadPhotoByContactId(resolver,contactId,false);
    }
    if (picture != null)     mSystemContactPicture.setImageBitmap(picture);
    mSystemContactLayout.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        launchContactActivity(contactId,context);
      }
    }
);
  }
}
Program: 8337
Project: 8337
Buggy source:
public static Bitmap loadPhotoByMasterKeyId(ContentResolver contentResolver,long masterKeyId,boolean highRes){
  if (masterKeyId == -1) {
    return null;
  }
  try {
    long rawContactId=findRawContactId(contentResolver,masterKeyId);
    if (rawContactId == -1) {
      return null;
    }
    Uri rawContactUri=ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI,rawContactId);
    Uri contactUri=ContactsContract.RawContacts.getContactLookupUri(contentResolver,rawContactUri);
    InputStream photoInputStream=ContactsContract.Contacts.openContactPhotoInputStream(contentResolver,contactUri,highRes);
    if (photoInputStream == null) {
      return null;
    }
    return BitmapFactory.decodeStream(photoInputStream);
  }
 catch (  Throwable ignored) {
    return null;
  }
}

Fixed version (ground truth):
public static Bitmap loadPhotoByMasterKeyId(ContentResolver contentResolver,long masterKeyId,boolean highRes){
  if (masterKeyId == -1) {
    return null;
  }
  try {
    long contactId=findContactId(contentResolver,masterKeyId);
    return loadPhotoByContactId(contentResolver,contactId,highRes);
  }
 catch (  Throwable ignored) {
    return null;
  }
}
Program: 8338
Project: 8338
Buggy source:
@Override public void setPassphrase(Passphrase passphrase){
  mPassphrase.removeFromMemory();
  mPassphrase=passphrase;
}

Fixed version (ground truth):
@Override public void setPassphrase(Passphrase passphrase){
  if (mPassphrase != null) {
    mPassphrase.removeFromMemory();
  }
  mPassphrase=passphrase;
}
Program: 8339
Project: 8339
Buggy source:
public static Showable createNotify(Activity activity,String msg,int duration,Style style,final ActionListener listener,int resIdAction){
}

Fixed version (ground truth):
public static Showable createNotify(final Activity activity,String msg,int duration,Style style,final ActionListener listener,int resIdAction){
}
Program: 8341
Project: 8341
Buggy source:
@Override public void onEncryptSuccess(SignEncryptResult result){
  if (mDeleteAfterEncrypt) {
    for (    Uri inputUri : mInputUris) {
      DeleteFileDialogFragment deleteFileDialog=DeleteFileDialogFragment.newInstance(inputUri);
      deleteFileDialog.show(getSupportFragmentManager(),"String_Node_Str");
    }
    mInputUris.clear();
    notifyUpdate();
  }
  if (mShareAfterEncrypt) {
    startActivity(sendWithChooserExcludingEncrypt());
  }
 else {
    result.createNotify(EncryptFilesActivity.this).show();
  }
}

Fixed version (ground truth):
@Override public void onEncryptSuccess(final SignEncryptResult result){
  if (mDeleteAfterEncrypt) {
    final Uri[] inputUris=mInputUris.toArray(new Uri[mInputUris.size()]);
    DeleteFileDialogFragment deleteFileDialog=DeleteFileDialogFragment.newInstance(inputUris);
    deleteFileDialog.setOnDeletedListener(new DeleteFileDialogFragment.OnDeletedListener(){
      @Override public void onDeleted(){
        if (mShareAfterEncrypt) {
          startActivity(sendWithChooserExcludingEncrypt());
        }
 else {
          result.createNotify(EncryptFilesActivity.this).show();
        }
      }
    }
);
    deleteFileDialog.show(getSupportFragmentManager(),"String_Node_Str");
    mInputUris.clear();
    notifyUpdate();
  }
 else {
    if (mShareAfterEncrypt) {
      startActivity(sendWithChooserExcludingEncrypt());
    }
 else {
      result.createNotify(EncryptFilesActivity.this).show();
    }
  }
}
Program: 8342
Project: 8342
Buggy source:
private void addInputUri(Uri inputUri){
  if (inputUri == null) {
    return;
  }
  mEncryptInterface.getInputUris().add(inputUri);
  mEncryptInterface.notifyUpdate();
  mSelectedFiles.requestFocus();
}

Fixed version (ground truth):
private void addInputUri(Uri inputUri){
  if (inputUri == null) {
    return;
  }
  if (mEncryptInterface.getInputUris().contains(inputUri)) {
    Notify.showNotify(getActivity(),getActivity().getString(R.string.error_file_added_already,FileHelper.getFilename(getActivity(),inputUri)),Notify.Style.ERROR);
    return;
  }
  mEncryptInterface.getInputUris().add(inputUri);
  mEncryptInterface.notifyUpdate();
  mSelectedFiles.requestFocus();
}
Program: 8344
Project: 8344
Buggy source:
/** 
 * Creates new instance of this delete file dialog fragment
 */
public static DeleteFileDialogFragment newInstance(Uri deleteUri){
  DeleteFileDialogFragment frag=new DeleteFileDialogFragment();
  Bundle args=new Bundle();
  args.putParcelable(ARG_DELETE_URI,deleteUri);
  frag.setArguments(args);
  return frag;
}

Fixed version (ground truth):
/** 
 * Creates new instance of this delete file dialog fragment
 */
public static DeleteFileDialogFragment newInstance(Uri... deleteUris){
  DeleteFileDialogFragment frag=new DeleteFileDialogFragment();
  Bundle args=new Bundle();
  args.putParcelableArray(ARG_DELETE_URIS,deleteUris);
  frag.setArguments(args);
  return frag;
}
Program: 8346
Project: 8346
Buggy source:
@Override protected void initLayout(){
  setContentView(R.layout.certify_fingerprint_activity);
}

Fixed version (ground truth):
@Override protected void initLayout(){
  setContentView(R.layout.certify_fingerprint_activity);
  changeToolbarColor();
}
Program: 8347
Project: 8347
Buggy source:
@Override protected void initLayout(){
  setContentView(R.layout.certify_key_activity);
}

Fixed version (ground truth):
@Override protected void initLayout(){
  setContentView(R.layout.certify_key_activity);
  changeToolbarColor();
}
Program: 8348
Project: 8348
Buggy source:
private void processScannedContent(Uri uri){
  Log.d(Constants.TAG,"String_Node_Str" + uri.toString());
  String fingerprint=null;
  if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals(Constants.FINGERPRINT_SCHEME)) {
    fingerprint=uri.getEncodedSchemeSpecificPart().toLowerCase(Locale.ENGLISH);
  }
  if (fingerprint == null) {
    SingletonResult result=new SingletonResult(SingletonResult.RESULT_ERROR,OperationResult.LogType.MSG_WRONG_QR_CODE);
    Intent intent=new Intent();
    intent.putExtra(SingletonResult.EXTRA_RESULT,result);
    returnResult(intent);
    return;
  }
  if (returnResult) {
    Intent result=new Intent();
    result.putExtra(EXTRA_FINGERPRINT,fingerprint);
    setResult(RESULT_OK,result);
    finish();
  }
 else {
    importKeys(fingerprint);
  }
}

Fixed version (ground truth):
private void processScannedContent(Uri uri){
  Log.d(Constants.TAG,"String_Node_Str" + uri);
  String fingerprint=null;
  if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals(Constants.FINGERPRINT_SCHEME)) {
    fingerprint=uri.getEncodedSchemeSpecificPart().toLowerCase(Locale.ENGLISH);
  }
  if (fingerprint == null) {
    SingletonResult result=new SingletonResult(SingletonResult.RESULT_ERROR,OperationResult.LogType.MSG_WRONG_QR_CODE);
    Intent intent=new Intent();
    intent.putExtra(SingletonResult.EXTRA_RESULT,result);
    returnResult(intent);
    return;
  }
  if (returnResult) {
    Intent result=new Intent();
    result.putExtra(EXTRA_FINGERPRINT,fingerprint);
    setResult(RESULT_OK,result);
    finish();
  }
 else {
    importKeys(fingerprint);
  }
}
Program: 8350
Project: 8350
Buggy source:
/** 
 * Load QR Code asynchronously and with a fade in animation
 * @param fingerprint
 */
private void loadQrCode(final String fingerprint){
  AsyncTask<Void,Void,Bitmap> loadTask=new AsyncTask<Void,Void,Bitmap>(){
    protected Bitmap doInBackground(    Void... unused){
      String qrCodeContent=Constants.FINGERPRINT_SCHEME + "String_Node_Str" + fingerprint;
      return QrCodeUtils.getQRCodeBitmap(qrCodeContent,0);
    }
    protected void onPostExecute(    Bitmap qrCode){
      Bitmap scaled=Bitmap.createScaledBitmap(qrCode,mQrCode.getHeight(),mQrCode.getHeight(),false);
      mQrCode.setImageBitmap(scaled);
      AlphaAnimation anim=new AlphaAnimation(0.0f,1.0f);
      anim.setDuration(200);
      mQrCode.startAnimation(anim);
    }
  }
;
  loadTask.execute();
}

Fixed version (ground truth):
/** 
 * Load QR Code asynchronously and with a fade in animation
 */
private void loadQrCode(final String fingerprint){
  AsyncTask<Void,Void,Bitmap> loadTask=new AsyncTask<Void,Void,Bitmap>(){
    protected Bitmap doInBackground(    Void... unused){
      String qrCodeContent=Constants.FINGERPRINT_SCHEME + "String_Node_Str" + fingerprint;
      return QrCodeUtils.getQRCodeBitmap(qrCodeContent,0);
    }
    protected void onPostExecute(    Bitmap qrCode){
      Bitmap scaled=Bitmap.createScaledBitmap(qrCode,mQrCode.getHeight(),mQrCode.getHeight(),false);
      mQrCode.setImageBitmap(scaled);
      AlphaAnimation anim=new AlphaAnimation(0.0f,1.0f);
      anim.setDuration(200);
      mQrCode.startAnimation(anim);
    }
  }
;
  loadTask.execute();
}
Program: 8353
Project: 8353
Buggy source:
private boolean mergeDupes(ImportKeysListEntry incoming,ImportKeysListEntry existing){
  boolean modified=false;
  if (incoming.isRevoked()) {
    existing.setRevoked(true);
    modified=true;
  }
  if (incoming.isExpired()) {
    existing.setExpired(true);
    modified=true;
  }
  for (  String origin : incoming.getOrigins()) {
    existing.addOrigin(origin);
  }
  ArrayList<String> incomingIDs=incoming.getUserIds();
  ArrayList<String> existingIDs=existing.getUserIds();
  for (  String incomingID : incomingIDs) {
    if (!existingIDs.contains(incomingID)) {
      existingIDs.add(incomingID);
      modified=true;
    }
  }
  existing.updateMergedUserIds();
  return modified;
}

Fixed version (ground truth):
private boolean mergeDupes(ImportKeysListEntry incoming,ImportKeysListEntry existing){
  boolean modified=false;
  if (incoming.isRevoked()) {
    existing.setRevoked(true);
    modified=true;
  }
  if (incoming.isExpired()) {
    existing.setExpired(true);
    modified=true;
  }
  for (  String origin : incoming.getOrigins()) {
    existing.addOrigin(origin);
    if (KeybaseKeyserver.ORIGIN.equals(origin)) {
      existing.setExtraData(incoming.getExtraData());
    }
  }
  ArrayList<String> incomingIDs=incoming.getUserIds();
  ArrayList<String> existingIDs=existing.getUserIds();
  for (  String incomingID : incomingIDs) {
    if (!existingIDs.contains(incomingID)) {
      existingIDs.add(incomingID);
      modified=true;
    }
  }
  existing.updateMergedUserIds();
  return modified;
}
Program: 8355
Project: 8355
Buggy source:
@Override public boolean canChildScrollUp(){
  if (mStickyListHeadersListView == null) {
    return super.canChildScrollUp();
  }
  return (mIsLocked || (mStickyListHeadersListView.getWrappedList().getChildCount() > 0 && (mStickyListHeadersListView.getTop() > 0 || mStickyListHeadersListView.getFirstVisiblePosition() > 0)));
}

Fixed version (ground truth):
@Override public boolean canChildScrollUp(){
  if (mStickyListHeadersListView == null) {
    return super.canChildScrollUp();
  }
  return (mIsLocked || (mStickyListHeadersListView.getWrappedList().getChildCount() > 0 && (mStickyListHeadersListView.getWrappedList().getChildAt(0).getTop() < 0 || mStickyListHeadersListView.getFirstVisiblePosition() > 0)));
}
Program: 8358
Project: 8358
Buggy source:
private KeyRing getCanonicalizedKeyRing(Uri queryUri,boolean secret) throws NotFoundException {
  Cursor cursor=mContentResolver.query(queryUri,new String[]{KeyRings.HAS_ANY_SECRET,KeyRings.VERIFIED,secret ? KeyRings.PRIVKEY_DATA : KeyRings.PUBKEY_DATA},null,null,null);
  try {
    if (cursor != null && cursor.moveToFirst()) {
      boolean hasAnySecret=cursor.getInt(0) > 0;
      int verified=cursor.getInt(1);
      byte[] blob=cursor.getBlob(2);
      if (secret & !hasAnySecret) {
        throw new NotFoundException("String_Node_Str");
      }
      return secret ? new CanonicalizedSecretKeyRing(blob,true,verified) : new CanonicalizedPublicKeyRing(blob,verified);
    }
 else {
      throw new NotFoundException("String_Node_Str");
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
}

Fixed version (ground truth):
private KeyRing getCanonicalizedKeyRing(Uri queryUri,boolean secret) throws NotFoundException {
  if (!queryUri.getPath().contains("String_Node_Str")) {
    throw new RuntimeException("String_Node_Str");
  }
  Cursor cursor=mContentResolver.query(queryUri,new String[]{KeyRings.HAS_ANY_SECRET,KeyRings.VERIFIED,secret ? KeyRings.PRIVKEY_DATA : KeyRings.PUBKEY_DATA},null,null,null);
  try {
    if (cursor != null && cursor.moveToFirst()) {
      boolean hasAnySecret=cursor.getInt(0) > 0;
      int verified=cursor.getInt(1);
      byte[] blob=cursor.getBlob(2);
      if (secret & !hasAnySecret) {
        throw new NotFoundException("String_Node_Str");
      }
      return secret ? new CanonicalizedSecretKeyRing(blob,true,verified) : new CanonicalizedPublicKeyRing(blob,verified);
    }
 else {
      throw new NotFoundException("String_Node_Str");
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
}
Program: 8359
Project: 8359
Buggy source:
private void uploadKey(){
  Intent intent=new Intent(this,KeychainIntentService.class);
  intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
  Uri blobUri=KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri);
  intent.setData(blobUri);
  Bundle data=new Bundle();
  String server=(String)mKeyServerSpinner.getSelectedItem();
  data.putString(KeychainIntentService.UPLOAD_KEY_SERVER,server);
  intent.putExtra(KeychainIntentService.EXTRA_DATA,data);
  KeychainIntentServiceHandler saveHandler=new KeychainIntentServiceHandler(this,getString(R.string.progress_exporting),ProgressDialog.STYLE_HORIZONTAL){
    public void handleMessage(    Message message){
      super.handleMessage(message);
      if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
        Toast.makeText(UploadKeyActivity.this,R.string.key_send_success,Toast.LENGTH_SHORT).show();
        finish();
      }
    }
  }
;
  Messenger messenger=new Messenger(saveHandler);
  intent.putExtra(KeychainIntentService.EXTRA_MESSENGER,messenger);
  saveHandler.showProgressDialog(this);
  startService(intent);
}

Fixed version (ground truth):
private void uploadKey(){
  Intent intent=new Intent(this,KeychainIntentService.class);
  intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
  Uri blobUri=KeyRings.buildUnifiedKeyRingUri(mDataUri);
  intent.setData(blobUri);
  Bundle data=new Bundle();
  String server=(String)mKeyServerSpinner.getSelectedItem();
  data.putString(KeychainIntentService.UPLOAD_KEY_SERVER,server);
  intent.putExtra(KeychainIntentService.EXTRA_DATA,data);
  KeychainIntentServiceHandler saveHandler=new KeychainIntentServiceHandler(this,getString(R.string.progress_exporting),ProgressDialog.STYLE_HORIZONTAL){
    public void handleMessage(    Message message){
      super.handleMessage(message);
      if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
        Toast.makeText(UploadKeyActivity.this,R.string.key_send_success,Toast.LENGTH_SHORT).show();
        finish();
      }
    }
  }
;
  Messenger messenger=new Messenger(saveHandler);
  intent.putExtra(KeychainIntentService.EXTRA_MESSENGER,messenger);
  saveHandler.showProgressDialog(this);
  startService(intent);
}
Program: 8363
Project: 8363
Buggy source:
/** 
 * Internal implementation to get cached passphrase.
 * @param keyId
 * @return
 */
private String getCachedPassphraseImpl(long keyId){
  if (keyId == Constants.key.symmetric) {
    Log.d(Constants.TAG,"String_Node_Str");
    String cachedPassphrase=mPassphraseCache.get(Constants.key.symmetric).getPassphrase();
    if (cachedPassphrase == null) {
      return null;
    }
    addCachedPassphrase(this,Constants.key.symmetric,cachedPassphrase,"String_Node_Str");
    return cachedPassphrase;
  }
  try {
    Log.d(Constants.TAG,"String_Node_Str" + keyId);
    WrappedSecretKeyRing key=new ProviderHelper(this).getWrappedSecretKeyRing(KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(keyId));
    if (!key.hasPassphrase()) {
      Log.d(Constants.TAG,"String_Node_Str");
      try {
        addCachedPassphrase(this,keyId,"String_Node_Str",key.getPrimaryUserId());
      }
 catch (      PgpGeneralException e) {
        Log.d(Constants.TAG,"String_Node_Str");
      }
      return "String_Node_Str";
    }
    CachedPassphrase cachedPassphrase=mPassphraseCache.get(keyId);
    if (cachedPassphrase == null) {
      Log.d(Constants.TAG,"String_Node_Str");
      return null;
    }
    Log.d(Constants.TAG,"String_Node_Str");
    addCachedPassphrase(this,keyId,cachedPassphrase.getPassphrase(),cachedPassphrase.getPrimaryUserID());
    return cachedPassphrase.getPassphrase();
  }
 catch (  ProviderHelper.NotFoundException e) {
    Log.e(Constants.TAG,"String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Internal implementation to get cached passphrase.
 * @param keyId
 * @return
 */
private String getCachedPassphraseImpl(long keyId){
  if (keyId == Constants.key.symmetric) {
    Log.d(Constants.TAG,"String_Node_Str");
    String cachedPassphrase=mPassphraseCache.get(Constants.key.symmetric).getPassphrase();
    if (cachedPassphrase == null) {
      return null;
    }
    addCachedPassphrase(this,Constants.key.symmetric,cachedPassphrase,getString(R.string.passp_cache_notif_pwd));
    return cachedPassphrase;
  }
  try {
    Log.d(Constants.TAG,"String_Node_Str" + keyId);
    WrappedSecretKeyRing key=new ProviderHelper(this).getWrappedSecretKeyRing(KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(keyId));
    if (!key.hasPassphrase()) {
      Log.d(Constants.TAG,"String_Node_Str");
      try {
        addCachedPassphrase(this,keyId,"String_Node_Str",key.getPrimaryUserId());
      }
 catch (      PgpGeneralException e) {
        Log.d(Constants.TAG,"String_Node_Str");
      }
      return "String_Node_Str";
    }
    CachedPassphrase cachedPassphrase=mPassphraseCache.get(keyId);
    if (cachedPassphrase == null) {
      Log.d(Constants.TAG,"String_Node_Str");
      return null;
    }
    Log.d(Constants.TAG,"String_Node_Str");
    addCachedPassphrase(this,keyId,cachedPassphrase.getPassphrase(),cachedPassphrase.getPrimaryUserID());
    return cachedPassphrase.getPassphrase();
  }
 catch (  ProviderHelper.NotFoundException e) {
    Log.e(Constants.TAG,"String_Node_Str");
    return null;
  }
}
Program: 8366
Project: 8366
Buggy source:
private void updateView(){
  if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
    mSelectKeysButton.setText(getString(R.string.select_keys_button_default));
  }
 else {
    mSelectKeysButton.setText(getResources().getQuantityString(R.plurals.select_keys_button,mEncryptionKeyIds.length,mEncryptionKeyIds.length));
  }
  if (mSecretKeyId == Constants.key.none) {
    mSign.setChecked(false);
    mMainUserId.setText("String_Node_Str");
    mMainUserIdRest.setText("String_Node_Str");
  }
 else {
    String[] userId;
    try {
      userId=mProviderHelper.getCachedPublicKeyRing(KeyRings.buildUnifiedKeyRingUri(mSecretKeyId)).getSplitPrimaryUserId();
    }
 catch (    PgpGeneralException e) {
      userId=null;
    }
    if (userId != null && userId[0] != null) {
      mMainUserId.setText(userId[0]);
    }
 else {
      mMainUserId.setText(getResources().getString(R.string.user_id_no_name));
    }
    if (userId != null && userId[1] != null) {
      mMainUserIdRest.setText(userId[1]);
    }
 else {
      mMainUserIdRest.setText("String_Node_Str");
    }
    mSign.setChecked(true);
  }
}

Fixed version (ground truth):
private void updateView(){
  if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
    mSelectKeysButton.setText(getString(R.string.select_keys_button_default));
  }
 else {
    mSelectKeysButton.setText(getResources().getQuantityString(R.plurals.select_keys_button,mEncryptionKeyIds.length,mEncryptionKeyIds.length));
  }
  if (mSecretKeyId == Constants.key.none) {
    mSign.setChecked(false);
    mMainUserId.setText("String_Node_Str");
    mMainUserIdRest.setText("String_Node_Str");
  }
 else {
    String[] userId;
    try {
      userId=mProviderHelper.getCachedPublicKeyRing(KeyRings.buildUnifiedKeyRingUri(mSecretKeyId)).getSplitPrimaryUserId();
    }
 catch (    PgpGeneralException e) {
      userId=null;
    }
    if (userId != null && userId[0] != null) {
      mMainUserId.setText(String.format("String_Node_Str",Long.parseLong(userId[0])));
    }
 else {
      mMainUserId.setText(getResources().getString(R.string.user_id_no_name));
    }
    if (userId != null && userId[1] != null) {
      mMainUserIdRest.setText(userId[1]);
    }
 else {
      mMainUserIdRest.setText("String_Node_Str");
    }
    mSign.setChecked(true);
  }
}