nus-yam/ex-repair huggingface dataset:
Program: 8232
Project: 8232
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  Intent intent=getActivity().getIntent();
  if (intent == null) {
    getActivity().finish();
    return;
  }
  if (savedInstanceState != null) {
    mResult=savedInstanceState.getParcelable(EXTRA_RESULT);
  }
 else {
    mResult=intent.getParcelableExtra(EXTRA_RESULT);
  }
  if (mResult == null) {
    getActivity().finish();
    return;
  }
  mAdapter=new LogAdapter(getActivity(),mResult.getLog());
  setListAdapter(mAdapter);
  getListView().setOnItemClickListener(this);
  getListView().setFastScrollEnabled(true);
  getListView().setDividerHeight(0);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  Intent intent=getActivity().getIntent();
  if (intent == null) {
    getActivity().finish();
    return;
  }
  if (savedInstanceState != null) {
    mResult=savedInstanceState.getParcelable(EXTRA_RESULT);
  }
 else {
    mResult=intent.getParcelableExtra(EXTRA_RESULT);
  }
  if (mResult == null) {
    getActivity().finish();
    return;
  }
  NestedLogAdapter adapter=new NestedLogAdapter(getContext(),mResult.getLog());
  adapter.setListener(this);
  setAdapter(adapter);
  setLayoutManager(new LayoutManager(getContext()));
}
Program: 8233
Project: 8233
Buggy source:
private void shareLog(){
  Activity activity=getActivity();
  if (activity == null) {
    return;
  }
  String log=mResult.getLog().getPrintableOperationLog(getResources(),0);
  if (mLogTempFile == null) {
    mLogTempFile=TemporaryFileProvider.createFile(getActivity(),"String_Node_Str","String_Node_Str");
    try {
      OutputStream outputStream=activity.getContentResolver().openOutputStream(mLogTempFile);
      outputStream.write(log.getBytes());
    }
 catch (    IOException e) {
      Notify.create(activity,R.string.error_log_share_internal,Style.ERROR).show();
      return;
    }
  }
  ShareLogDialogFragment shareLogDialog=ShareLogDialogFragment.newInstance(mLogTempFile);
  shareLogDialog.show(getActivity().getSupportFragmentManager(),"String_Node_Str");
}

Fixed version (ground truth):
private void shareLog(){
  Activity activity=getActivity();
  if (activity == null) {
    return;
  }
  String log=mResult.getLog().getPrintableOperationLog(getResources(),0);
  if (mLogTempFile == null) {
    mLogTempFile=TemporaryFileProvider.createFile(getActivity(),"String_Node_Str","String_Node_Str");
    try {
      OutputStream outputStream=activity.getContentResolver().openOutputStream(mLogTempFile);
      outputStream.write(log.getBytes());
    }
 catch (    IOException|NullPointerException e) {
      Notify.create(activity,R.string.error_log_share_internal,Style.ERROR).show();
      return;
    }
  }
  ShareLogDialogFragment shareLogDialog=ShareLogDialogFragment.newInstance(mLogTempFile);
  shareLogDialog.show(getActivity().getSupportFragmentManager(),"String_Node_Str");
}
Program: 8234
Project: 8234
Buggy source:
/** 
 * Recommended constructor.
 * @param c The cursor from which to get the data.
 * @param context The context
 * @param flags Flags used to determine the behavior of the adapter
 * @see #FLAG_REGISTER_CONTENT_OBSERVER
 */
public CursorAdapter(Context context,C c,int flags){
  init(context,c,flags);
}

Fixed version (ground truth):
/** 
 * Recommended constructor.
 * @param c The cursor from which to get the data.
 * @param context The context
 * @param flags Flags used to determine the behavior of the adapter
 * @see #FLAG_REGISTER_CONTENT_OBSERVER
 */
public CursorAdapter(Context context,C c,int flags){
  setHasStableIds(true);
  init(context,c,flags);
}
Program: 8235
Project: 8235
Buggy source:
public SectionCursorAdapter(Context context,C cursor,int flags,Comparator<T> comparator){
  super(context,cursor,flags);
  setHasStableIds(false);
  setSectionComparator(comparator);
}

Fixed version (ground truth):
public SectionCursorAdapter(Context context,C cursor,int flags,Comparator<T> comparator){
  super(context,cursor,flags);
  setSectionComparator(comparator);
}
Program: 8236
Project: 8236
Buggy source:
@SuppressWarnings("String_Node_Str") private void ensureList(){
  if (listView != null)   return;
  View root=getView();
  if (root == null)   throw new IllegalStateException("String_Node_Str");
  if (root instanceof RecyclerView) {
    listView=(RecyclerView)root;
  }
 else {
    emptyView=root.findViewById(INTERNAL_EMPTY_VIEW_ID);
    if (emptyView != null) {
      emptyView.setVisibility(View.GONE);
    }
    progressContainer=root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID);
    listContainer=root.findViewById(INTERNAL_LIST_CONTAINER_ID);
    View rawListView=root.findViewById(INTERNAL_LIST_VIEW_ID);
    if (!(rawListView instanceof RecyclerView)) {
      if (rawListView == null) {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str");
      }
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    listView=(RecyclerView)rawListView;
  }
  if (layoutManager != null) {
    RecyclerView.LayoutManager manager=layoutManager;
    this.layoutManager=null;
    setLayoutManager(manager);
  }
  listShown=true;
  listView.setHasFixedSize(isFixedSize());
  listView.addOnScrollListener(scrollListener);
  if (this.adapter != null) {
    A adapter=this.adapter;
    this.adapter=null;
    setAdapter(adapter);
  }
 else {
    if (progressContainer != null) {
      setListShown(false,false);
    }
  }
  handler.post(requestFocus);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void ensureList(){
  if (listView != null) {
    return;
  }
  View root=getView();
  if (root == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (root instanceof RecyclerView) {
    listView=(RecyclerView)root;
  }
 else {
    emptyView=root.findViewById(INTERNAL_EMPTY_VIEW_ID);
    if (emptyView != null) {
      emptyView.setVisibility(View.GONE);
    }
    progressContainer=root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID);
    listContainer=root.findViewById(INTERNAL_LIST_CONTAINER_ID);
    View rawListView=root.findViewById(INTERNAL_LIST_VIEW_ID);
    if (!(rawListView instanceof RecyclerView)) {
      if (rawListView == null) {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str");
      }
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    listView=(RecyclerView)rawListView;
  }
  if (layoutManager != null) {
    RecyclerView.LayoutManager manager=layoutManager;
    this.layoutManager=null;
    setLayoutManager(manager);
  }
  listShown=true;
  listView.setHasFixedSize(isFixedSize());
  listView.addOnScrollListener(scrollListener);
  if (this.adapter != null) {
    A adapter=this.adapter;
    this.adapter=null;
    setAdapter(adapter);
  }
 else {
    if (progressContainer != null) {
      setListShown(false,false);
    }
  }
  handler.post(requestFocus);
}
Program: 8237
Project: 8237
Buggy source:
public static void importKeysFromResource(Context context,String name) throws Exception {
  IteratorWithIOThrow<UncachedKeyRing> stream=UncachedKeyRing.fromStream(getInstrumentation().getContext().getAssets().open(name));
  ProviderHelper helper=new ProviderHelper(context);
  while (stream.hasNext()) {
    UncachedKeyRing ring=stream.next();
    if (ring.isSecret()) {
      helper.saveSecretKeyRing(ring,new ProgressScaler());
    }
 else {
      helper.savePublicKeyRing(ring,new ProgressScaler());
    }
  }
}

Fixed version (ground truth):
public static void importKeysFromResource(Context context,String name) throws Exception {
  IteratorWithIOThrow<UncachedKeyRing> stream=UncachedKeyRing.fromStream(getInstrumentation().getContext().getAssets().open(name));
  ProviderHelper helper=new ProviderHelper(context);
  while (stream.hasNext()) {
    UncachedKeyRing ring=stream.next();
    if (ring.isSecret()) {
      helper.saveSecretKeyRing(ring,new ProgressScaler());
    }
 else {
      helper.savePublicKeyRing(ring);
    }
  }
}
Program: 8238
Project: 8238
Buggy source:
@Test public void test01Edit() throws Exception {
  Activity activity=mActivity.getActivity();
  new KeychainDatabase(activity).clearDatabase();
  importKeysFromResource(activity,"String_Node_Str");
  onData(withKeyItemId(0x9D604D2F310716A3L)).inAdapterView(allOf(isAssignableFrom(AdapterView.class),isDescendantOfA(ViewMatchers.withId(R.id.key_list_list)))).perform(click());
  onView(withId(R.id.menu_key_view_edit)).perform(click());
  onView(withText(R.string.btn_save)).perform(click());
  checkSnackbar(Style.ERROR,R.string.msg_mf_error_noop);
}

Fixed version (ground truth):
@Test public void test01Edit() throws Exception {
  Activity activity=mActivity.getActivity();
  new KeychainDatabase(activity).clearDatabase();
  importKeysFromResource(activity,"String_Node_Str");
  onData(withKeyItemId(0x9D604D2F310716A3L)).inAdapterView(allOf(isAssignableFrom(AdapterView.class),isDescendantOfA(ViewMatchers.withId(R.id.key_list_list)))).perform(click());
  onView(withId(R.id.view_key_card_user_ids_edit)).perform(click());
  onView(withText(R.string.btn_save)).perform(click());
  checkSnackbar(Style.ERROR,R.string.msg_mf_error_noop);
}
Program: 8240
Project: 8240
Buggy source:
/** 
 * Check if device is was connected to and still is connected
 * @return true if device is connected
 */
@Override public boolean isConnected(){
  return mConnection != null && mUsbManager.getDeviceList().containsValue(mUsbDevice);
}

Fixed version (ground truth):
/** 
 * Check if device is was connected to and still is connected
 * @return true if device is connected
 */
@Override public boolean isConnected(){
  return mConnection != null && mUsbManager.getDeviceList().containsValue(mUsbDevice) && mConnection.getSerial() != null;
}
Program: 8241
Project: 8241
Buggy source:
/** 
 * Connect to OTG device
 * @throws IOException
 */
@Override public void connect() throws IOException {
  mCounter=0;
  mUsbInterface=getSmartCardInterface(mUsbDevice);
  if (mUsbInterface == null) {
    throw new UsbTransportException("String_Node_Str");
  }
  final Pair<UsbEndpoint,UsbEndpoint> ioEndpoints=getIoEndpoints(mUsbInterface);
  mBulkIn=ioEndpoints.first;
  mBulkOut=ioEndpoints.second;
  if (mBulkIn == null || mBulkOut == null) {
    throw new UsbTransportException("String_Node_Str");
  }
  mConnection=mUsbManager.openDevice(mUsbDevice);
  if (mConnection == null) {
    throw new UsbTransportException("String_Node_Str");
  }
  if (!mConnection.claimInterface(mUsbInterface,true)) {
    throw new UsbTransportException("String_Node_Str");
  }
  iccPowerSet(true);
  Log.d(Constants.TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Connect to OTG device
 * @throws IOException
 */
@Override public void connect() throws IOException {
  mCounter=0;
  mUsbInterface=getSmartCardInterface(mUsbDevice);
  if (mUsbInterface == null) {
    throw new UsbTransportException("String_Node_Str");
  }
  final Pair<UsbEndpoint,UsbEndpoint> ioEndpoints=getIoEndpoints(mUsbInterface);
  mBulkIn=ioEndpoints.first;
  mBulkOut=ioEndpoints.second;
  if (mBulkIn == null || mBulkOut == null) {
    throw new UsbTransportException("String_Node_Str");
  }
  mConnection=mUsbManager.openDevice(mUsbDevice);
  if (mConnection == null) {
    throw new UsbTransportException("String_Node_Str");
  }
  if (!mConnection.claimInterface(mUsbInterface,true)) {
    throw new UsbTransportException("String_Node_Str");
  }
  setIccPower(true);
  Log.d(Constants.TAG,"String_Node_Str");
}
Program: 8242
Project: 8242
Buggy source:
public void usbDeviceDiscovered(final UsbTransport transport){
  if (!mTagHandlingEnabled)   return;
  securityTokenDiscovered(transport);
}

Fixed version (ground truth):
public void usbDeviceDiscovered(final UsbDevice usbDevice){
  if (!mTagHandlingEnabled)   return;
  UsbManager usbManager=(UsbManager)getSystemService(Context.USB_SERVICE);
  securityTokenDiscovered(new UsbTransport(usbDevice,usbManager));
}
Program: 8243
Project: 8243
Buggy source:
protected void handleSmartcard(Transport transport) throws IOException {
  if (!(mSecurityTokenHelper.isConnected() && mSecurityTokenHelper.getTransport().equals(transport))) {
    mSecurityTokenHelper.setTransport(transport);
    mSecurityTokenHelper.connectToDevice();
  }
  doSecurityTokenInBackground();
}

Fixed version (ground truth):
protected void handleSmartcard(Transport transport) throws IOException {
  if (!(mSecurityTokenHelper.isPersistentConnectionAllowed() && mSecurityTokenHelper.isConnected() && mSecurityTokenHelper.getTransport().equals(transport))) {
    mSecurityTokenHelper.setTransport(transport);
    mSecurityTokenHelper.connectToDevice();
  }
  doSecurityTokenInBackground();
}
Program: 8244
Project: 8244
Buggy source:
/** 
 * Run smartcard routines if last used token is connected and supports persistent connections
 */
protected void checkDeviceConnection(){
  mUsbDispatcher.rescanDevices();
}

Fixed version (ground truth):
/** 
 * Run smartcard routines if last used token is connected and supports persistent connections
 */
public void checkDeviceConnection(){
  mUsbDispatcher.rescanDevices();
}
Program: 8245
Project: 8245
Buggy source:
void usbDeviceDiscovered(UsbTransport usbTransport);

Fixed version (ground truth):
void usbDeviceDiscovered(UsbDevice usbDevice);
Program: 8246
Project: 8246
Buggy source:
public void onStart(){
  final IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(UsbEventReceiverActivity.ACTION_USB_PERMISSION);
  intentFilter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
  mActivity.registerReceiver(mUsbReceiver,intentFilter);
}

Fixed version (ground truth):
public void onStart(){
  final IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(UsbEventReceiverActivity.ACTION_USB_PERMISSION);
  mActivity.registerReceiver(mUsbReceiver,intentFilter);
}
Program: 8247
Project: 8247
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
switch (action) {
case UsbEventReceiverActivity.ACTION_USB_PERMISSION:
{
      UsbDevice usbDevice=intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
      boolean permission=intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED,false);
      if (permission) {
        Log.d(Constants.TAG,"String_Node_Str" + usbDevice.getDeviceName());
        mLastUsedUsbTransport=new UsbTransport(usbDevice,mUsbManager);
        mListener.usbDeviceDiscovered(mLastUsedUsbTransport);
      }
      break;
    }
case UsbManager.ACTION_USB_DEVICE_DETACHED:
{
    UsbDevice usbDevice=intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    if (mLastUsedUsbTransport != null && mLastUsedUsbTransport.getUsbDevice().equals(usbDevice)) {
      mLastUsedUsbTransport.release();
      mLastUsedUsbTransport=null;
    }
    break;
  }
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
switch (action) {
case UsbEventReceiverActivity.ACTION_USB_PERMISSION:
{
      android.hardware.usb.UsbDevice usbDevice=intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
      boolean permission=intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED,false);
      if (permission) {
        Log.d(Constants.TAG,"String_Node_Str" + usbDevice.getDeviceName());
        mListener.usbDeviceDiscovered(usbDevice);
      }
      break;
    }
}
}
Program: 8248
Project: 8248
Buggy source:
/** 
 * Rescans devices and triggers   {@link OnDiscoveredUsbDeviceListener}
 */
public void rescanDevices(){
  for (  UsbDevice device : mUsbManager.getDeviceList().values()) {
    if (mUsbManager.hasPermission(device)) {
      if (mListener != null) {
        mListener.usbDeviceDiscovered(new UsbTransport(device,mUsbManager));
      }
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Rescans devices and triggers   {@link OnDiscoveredUsbDeviceListener}
 */
public void rescanDevices(){
  for (  UsbDevice device : mUsbManager.getDeviceList().values()) {
    if (mUsbManager.hasPermission(device)) {
      if (mListener != null) {
        mListener.usbDeviceDiscovered(device);
      }
      break;
    }
  }
}
Program: 8249
Project: 8249
Buggy source:
PgpSignEncryptInputParcel(Parcel source){
  ClassLoader loader=getClass().getClassLoader();
  mVersionHeader=source.readString();
  mEnableAsciiArmorOutput=source.readInt() == 1;
  mCompressionAlgorithm=source.readInt();
  mEncryptionMasterKeyIds=source.createLongArray();
  mSymmetricPassphrase=source.readParcelable(loader);
  mSymmetricEncryptionAlgorithm=source.readInt();
  mSignatureMasterKeyId=source.readLong();
  mSignatureSubKeyId=source.readInt() == 1 ? source.readLong() : null;
  mSignatureHashAlgorithm=source.readInt();
  mAdditionalEncryptId=source.readLong();
  mFailOnMissingEncryptionKeyIds=source.readInt() == 1;
  mCharset=source.readString();
  mCleartextSignature=source.readInt() == 1;
  mDetachedSignature=source.readInt() == 1;
  mHiddenRecipients=source.readInt() == 1;
  mIntegrityProtected=source.readInt() == 1;
  mAddBackupHeader=source.readInt() == 1;
}

Fixed version (ground truth):
PgpSignEncryptInputParcel(Parcel source){
  ClassLoader loader=getClass().getClassLoader();
  mVersionHeader=source.readString();
  mEnableAsciiArmorOutput=source.readInt() == 1;
  mCompressionAlgorithm=source.readInt();
  mEncryptionMasterKeyIds=source.createLongArray();
  mSymmetricPassphrase=source.readParcelable(loader);
  mSymmetricEncryptionAlgorithm=source.readInt();
  mSignatureMasterKeyId=source.readLong();
  mSignatureSubKeyId=source.readInt() == 1 ? source.readLong() : null;
  mSignatureHashAlgorithm=source.readInt();
  mAdditionalEncryptId=source.readLong();
  mCharset=source.readString();
  mCleartextSignature=source.readInt() == 1;
  mDetachedSignature=source.readInt() == 1;
  mHiddenRecipients=source.readInt() == 1;
  mIntegrityProtected=source.readInt() == 1;
  mAddBackupHeader=source.readInt() == 1;
}
Program: 8250
Project: 8250
Buggy source:
@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(mVersionHeader);
  dest.writeInt(mEnableAsciiArmorOutput ? 1 : 0);
  dest.writeInt(mCompressionAlgorithm);
  dest.writeLongArray(mEncryptionMasterKeyIds);
  dest.writeParcelable(mSymmetricPassphrase,0);
  dest.writeInt(mSymmetricEncryptionAlgorithm);
  dest.writeLong(mSignatureMasterKeyId);
  if (mSignatureSubKeyId != null) {
    dest.writeInt(1);
    dest.writeLong(mSignatureSubKeyId);
  }
 else {
    dest.writeInt(0);
  }
  dest.writeInt(mSignatureHashAlgorithm);
  dest.writeLong(mAdditionalEncryptId);
  dest.writeInt(mFailOnMissingEncryptionKeyIds ? 1 : 0);
  dest.writeString(mCharset);
  dest.writeInt(mCleartextSignature ? 1 : 0);
  dest.writeInt(mDetachedSignature ? 1 : 0);
  dest.writeInt(mHiddenRecipients ? 1 : 0);
  dest.writeInt(mIntegrityProtected ? 1 : 0);
  dest.writeInt(mAddBackupHeader ? 1 : 0);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(mVersionHeader);
  dest.writeInt(mEnableAsciiArmorOutput ? 1 : 0);
  dest.writeInt(mCompressionAlgorithm);
  dest.writeLongArray(mEncryptionMasterKeyIds);
  dest.writeParcelable(mSymmetricPassphrase,0);
  dest.writeInt(mSymmetricEncryptionAlgorithm);
  dest.writeLong(mSignatureMasterKeyId);
  if (mSignatureSubKeyId != null) {
    dest.writeInt(1);
    dest.writeLong(mSignatureSubKeyId);
  }
 else {
    dest.writeInt(0);
  }
  dest.writeInt(mSignatureHashAlgorithm);
  dest.writeLong(mAdditionalEncryptId);
  dest.writeString(mCharset);
  dest.writeInt(mCleartextSignature ? 1 : 0);
  dest.writeInt(mDetachedSignature ? 1 : 0);
  dest.writeInt(mHiddenRecipients ? 1 : 0);
  dest.writeInt(mIntegrityProtected ? 1 : 0);
  dest.writeInt(mAddBackupHeader ? 1 : 0);
}
Program: 8253
Project: 8253
Buggy source:
public KeyItem(CanonicalizedPublicKeyRing ring){
  CanonicalizedPublicKey key=ring.getPublicKey();
  String userId=key.getPrimaryUserIdWithFallback();
  mUserId=KeyRing.splitUserId(userId);
  mUserIdFull=userId;
  mKeyId=ring.getMasterKeyId();
  mHasDuplicate=false;
  mCreation=key.getCreationTime();
  mFingerprint=KeyFormattingUtils.convertFingerprintToHex(ring.getFingerprint());
  mIsRevoked=key.isRevoked();
  mIsExpired=key.isExpired();
  mIsSecret=false;
  mIsVerified=false;
}

Fixed version (ground truth):
public KeyItem(CanonicalizedPublicKeyRing ring){
  CanonicalizedPublicKey key=ring.getPublicKey();
  String userId=key.getPrimaryUserIdWithFallback();
  mUserId=KeyRing.splitUserId(userId);
  mUserIdFull=userId;
  mKeyId=ring.getMasterKeyId();
  mHasDuplicate=false;
  mHasEncrypt=key.getKeyRing().getEncryptIds().size() > 0;
  mCreation=key.getCreationTime();
  mFingerprint=KeyFormattingUtils.convertFingerprintToHex(ring.getFingerprint());
  mIsRevoked=key.isRevoked();
  mIsExpired=key.isExpired();
  mIsSecret=false;
  mIsVerified=false;
}
Program: 8254
Project: 8254
Buggy source:
@Override protected View getViewForObject(KeyItem keyItem){
  LayoutInflater l=LayoutInflater.from(getContext());
  View view=l.inflate(R.layout.recipient_box_entry,null);
  ((TextView)view.findViewById(android.R.id.text1)).setText(keyItem.getReadableName());
  return view;
}

Fixed version (ground truth):
@Override protected View getViewForObject(KeyItem keyItem){
  LayoutInflater l=LayoutInflater.from(getContext());
  View view=l.inflate(R.layout.recipient_box_entry,null);
  ((TextView)view.findViewById(android.R.id.text1)).setText(keyItem.getReadableName());
  if (keyItem.mIsRevoked || !keyItem.mHasEncrypt || keyItem.mIsExpired) {
    ((TextView)view.findViewById(android.R.id.text1)).setTextColor(Color.RED);
  }
  return view;
}
Program: 8255
Project: 8255
Buggy source:
public ArrayList<CertifyActionsParcel.CertifyAction> getSelectedCertifyActions(){
  return mUserIdsAdapter.getSelectedCertifyActions();
}

Fixed version (ground truth):
public ArrayList<CertifyActionsParcel.CertifyAction> getSelectedCertifyActions(){
  if (!checkboxVisibility) {
    throw new AssertionError("String_Node_Str");
  }
  return mUserIdsAdapter.getSelectedCertifyActions();
}
Program: 8256
Project: 8256
Buggy source:
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  mPubMasterKeyIds=getActivity().getIntent().getLongArrayExtra(EXTRA_KEY_IDS);
  if (mPubMasterKeyIds == null) {
    Log.e(Constants.TAG,"String_Node_Str");
    getActivity().finish();
    return;
  }
  ArrayList<Boolean> checkedStates=null;
  if (savedInstanceState != null) {
    checkedStates=(ArrayList<Boolean>)savedInstanceState.getSerializable(ARG_CHECK_STATES);
  }
  mUserIdsAdapter=new MultiUserIdsAdapter(getActivity(),null,0,checkedStates);
  mUserIds.setAdapter(mUserIdsAdapter);
  mUserIds.setDividerHeight(0);
  getLoaderManager().initLoader(0,null,this);
}

Fixed version (ground truth):
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  mPubMasterKeyIds=getActivity().getIntent().getLongArrayExtra(EXTRA_KEY_IDS);
  if (mPubMasterKeyIds == null) {
    Log.e(Constants.TAG,"String_Node_Str");
    getActivity().finish();
    return;
  }
  ArrayList<Boolean> checkedStates=null;
  if (savedInstanceState != null) {
    checkedStates=(ArrayList<Boolean>)savedInstanceState.getSerializable(ARG_CHECK_STATES);
  }
  mUserIdsAdapter=new MultiUserIdsAdapter(getActivity(),null,0,checkedStates,checkboxVisibility);
  mUserIds.setAdapter(mUserIdsAdapter);
  mUserIds.setDividerHeight(0);
  getLoaderManager().initLoader(0,null,this);
}
Program: 8257
Project: 8257
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mUploadButton=findViewById(R.id.upload_key_action_upload);
  mKeyServerSpinner=(Spinner)findViewById(R.id.upload_key_keyserver);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,Preferences.getPreferences(this).getKeyServers());
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mKeyServerSpinner.setAdapter(adapter);
  if (adapter.getCount() > 0) {
    mKeyServerSpinner.setSelection(0);
  }
 else {
    mUploadButton.setEnabled(false);
  }
  mUploadButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      uploadKey();
    }
  }
);
  mDataUri=getIntent().getData();
  if (mDataUri == null) {
    Log.e(Constants.TAG,"String_Node_Str");
    finish();
    return;
  }
  try {
    mMasterKeyId=new ProviderHelper(this).getCachedPublicKeyRing(KeyRings.buildUnifiedKeyRingUri(mDataUri)).getMasterKeyId();
  }
 catch (  PgpKeyNotFoundException e) {
    Log.e(Constants.TAG,"String_Node_Str");
    finish();
    return;
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mUploadButton=findViewById(R.id.upload_key_action_upload);
  mKeyServerSpinner=(Spinner)findViewById(R.id.upload_key_keyserver);
  MultiUserIdsFragment mMultiUserIdsFragment=(MultiUserIdsFragment)getSupportFragmentManager().findFragmentById(R.id.multi_user_ids_fragment);
  mMultiUserIdsFragment.setCheckboxVisibility(false);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,Preferences.getPreferences(this).getKeyServers());
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mKeyServerSpinner.setAdapter(adapter);
  if (adapter.getCount() > 0) {
    mKeyServerSpinner.setSelection(0);
  }
 else {
    mUploadButton.setEnabled(false);
  }
  mUploadButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      uploadKey();
    }
  }
);
  mDataUri=getIntent().getData();
  if (mDataUri == null) {
    Log.e(Constants.TAG,"String_Node_Str");
    finish();
    return;
  }
}
Program: 8258
Project: 8258
Buggy source:
@Override public UploadKeyringParcel createOperationInput(){
  return new UploadKeyringParcel(mKeyserver,mMasterKeyId);
}

Fixed version (ground truth):
@Override public UploadKeyringParcel createOperationInput(){
  long[] masterKeyIds=getIntent().getLongArrayExtra(MultiUserIdsFragment.EXTRA_KEY_IDS);
  return new UploadKeyringParcel(mKeyserver,masterKeyIds[0]);
}
Program: 8259
Project: 8259
Buggy source:
private void uploadToKeyserver(){
  Intent uploadIntent=new Intent(getActivity(),UploadKeyActivity.class);
  uploadIntent.setData(mDataUri);
  startActivityForResult(uploadIntent,0);
}

Fixed version (ground truth):
private void uploadToKeyserver(){
  long keyId;
  try {
    keyId=new ProviderHelper(getActivity()).getCachedPublicKeyRing(mDataUri).extractOrGetMasterKeyId();
  }
 catch (  PgpKeyNotFoundException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
    Notify.create(getActivity(),"String_Node_Str",Style.ERROR).show();
    return;
  }
  Intent uploadIntent=new Intent(getActivity(),UploadKeyActivity.class);
  uploadIntent.setData(mDataUri);
  uploadIntent.putExtra(MultiUserIdsFragment.EXTRA_KEY_IDS,new long[]{keyId});
  startActivityForResult(uploadIntent,0);
}
Program: 8261
Project: 8261
Buggy source:
public MultiUserIdsAdapter(Context context,Cursor c,int flags,ArrayList<Boolean> preselectStates){
  super(context,c,flags);
  mInflater=LayoutInflater.from(context);
  mCheckStates=preselectStates == null ? new ArrayList<Boolean>() : preselectStates;
}

Fixed version (ground truth):
public MultiUserIdsAdapter(Context context,Cursor c,int flags,ArrayList<Boolean> preselectStates,boolean checkboxVisibility){
  this(context,c,flags,preselectStates);
  this.checkboxVisibility=checkboxVisibility;
}
Program: 8262
Project: 8262
Buggy source:
@Override boolean isItemEnabled(Cursor cursor){
  if (cursor.getPosition() == 0) {
    return true;
  }
  if (cursor.getInt(KeyAdapter.INDEX_IS_REVOKED) != 0) {
    return false;
  }
  if (cursor.getInt(KeyAdapter.INDEX_IS_EXPIRED) != 0) {
    return false;
  }
  if (cursor.isNull(mIndexHasCertify)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override boolean isItemEnabled(Cursor cursor){
  if (cursor.getInt(KeyAdapter.INDEX_IS_REVOKED) != 0) {
    return false;
  }
  if (cursor.getInt(KeyAdapter.INDEX_IS_EXPIRED) != 0) {
    return false;
  }
  if (cursor.isNull(mIndexHasCertify)) {
    return false;
  }
  return true;
}
Program: 8263
Project: 8263
Buggy source:
@Override boolean isItemEnabled(Cursor cursor){
  if (cursor.getPosition() == 0) {
    return true;
  }
  if (cursor.getInt(KeyAdapter.INDEX_IS_REVOKED) != 0) {
    return false;
  }
  if (cursor.getInt(KeyAdapter.INDEX_IS_EXPIRED) != 0) {
    return false;
  }
  if (cursor.isNull(mIndexHasSign)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override boolean isItemEnabled(Cursor cursor){
  if (cursor.getInt(KeyAdapter.INDEX_IS_REVOKED) != 0) {
    return false;
  }
  if (cursor.getInt(KeyAdapter.INDEX_IS_EXPIRED) != 0) {
    return false;
  }
  if (cursor.isNull(mIndexHasSign)) {
    return false;
  }
  return true;
}
Program: 8265
Project: 8265
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  initTheme();
  super.onCreate(savedInstanceState);
  initLayout();
  initToolbar();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  initTheme();
  initLayout();
  initToolbar();
}
Program: 8266
Project: 8266
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setFullScreenDialogClose(Activity.RESULT_CANCELED,true);
  findViewById(R.id.import_import).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      importSelectedKeys();
    }
  }
);
  if (getIntent().hasExtra(EXTRA_PENDING_INTENT_DATA)) {
    mPendingIntentData=getIntent().getParcelableExtra(EXTRA_PENDING_INTENT_DATA);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mFreshIntent=true;
  setFullScreenDialogClose(Activity.RESULT_CANCELED,true);
  findViewById(R.id.import_import).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      importSelectedKeys();
    }
  }
);
  if (getIntent().hasExtra(EXTRA_PENDING_INTENT_DATA)) {
    mPendingIntentData=getIntent().getParcelableExtra(EXTRA_PENDING_INTENT_DATA);
  }
}
Program: 8268
Project: 8268
Buggy source:
@Override public void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  setIntent(intent);
}

Fixed version (ground truth):
@Override public void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  setIntent(intent);
  mFreshIntent=true;
}
Program: 8269
Project: 8269
Buggy source:
@Override protected void onResumeFragments(){
  super.onResumeFragments();
  handleActions(getIntent());
}

Fixed version (ground truth):
@Override protected void onResumeFragments(){
  super.onResumeFragments();
  if (mFreshIntent) {
    handleActions(getIntent());
    mFreshIntent=false;
  }
}
Program: 8270
Project: 8270
Buggy source:
/** 
 * returns an indented String of an entire OperationLog
 * @param indent padding to add at the start of all log entries, made for use with SubLogs
 * @return printable, indented version of passed operationLog
 */
public String getPrintableOperationLog(Resources resources,int indent){
  StringBuilder log=new StringBuilder();
  for (  LogEntryParcel entry : this) {
    log.append(entry.getPrintableLogEntry(resources,indent)).append("String_Node_Str");
  }
  return log.toString().substring(0,log.length() - 1);
}

Fixed version (ground truth):
/** 
 * returns an indented String of an entire OperationLog
 * @param indent padding to add at the start of all log entries, made for use with SubLogs
 * @return printable, indented version of passed operationLog
 */
public String getPrintableOperationLog(Resources resources,int indent){
  StringBuilder log=new StringBuilder();
  for (  LogEntryParcel entry : this) {
    log.append(entry.getPrintableLogEntry(resources,indent)).append("String_Node_Str");
  }
  if (log.length() >= 1) {
    return log.toString().substring(0,log.length() - 1);
  }
 else {
    return log.toString();
  }
}
Program: 8271
Project: 8271
Buggy source:
private Intent getSignKeyIdImpl(Intent data){
  String preferredUserId=data.getStringExtra(OpenPgpApi.EXTRA_USER_ID);
  Intent intent=new Intent(getBaseContext(),SelectSignKeyIdActivity.class);
  String currentPkg=getCurrentCallingPackage();
  intent.setData(KeychainContract.ApiApps.buildByPackageNameUri(currentPkg));
  intent.putExtra(SelectSignKeyIdActivity.EXTRA_USER_ID,preferredUserId);
  intent.putExtra(SelectSignKeyIdActivity.EXTRA_DATA,data);
  PendingIntent pi=PendingIntent.getActivity(getBaseContext(),0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  Intent result=new Intent();
  result.putExtra(OpenPgpApi.RESULT_CODE,OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
  result.putExtra(OpenPgpApi.RESULT_INTENT,pi);
  return result;
}

Fixed version (ground truth):
private Intent getSignKeyIdImpl(Intent data){
  if (data.hasExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID)) {
    long signKeyId=data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID,Constants.key.none);
    Intent result=new Intent();
    result.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID,signKeyId);
    result.putExtra(OpenPgpApi.RESULT_CODE,OpenPgpApi.RESULT_CODE_SUCCESS);
    return result;
  }
 else {
    String preferredUserId=data.getStringExtra(OpenPgpApi.EXTRA_USER_ID);
    Intent intent=new Intent(getBaseContext(),SelectSignKeyIdActivity.class);
    String currentPkg=getCurrentCallingPackage();
    intent.setData(KeychainContract.ApiApps.buildByPackageNameUri(currentPkg));
    intent.putExtra(SelectSignKeyIdActivity.EXTRA_USER_ID,preferredUserId);
    intent.putExtra(SelectSignKeyIdActivity.EXTRA_DATA,data);
    PendingIntent pi=PendingIntent.getActivity(getBaseContext(),0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
    Intent result=new Intent();
    result.putExtra(OpenPgpApi.RESULT_CODE,OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
    result.putExtra(OpenPgpApi.RESULT_INTENT,pi);
    return result;
  }
}
Program: 8272
Project: 8272
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setFullScreenDialogClose(new View.OnClickListener(){
    @Override public void onClick(    View v){
      setResult(RESULT_CANCELED);
      finish();
    }
  }
);
  mActionCreateKey=(TextView)findViewById(R.id.api_select_sign_key_create_key);
  mActionCreateKey.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      createKey(mPreferredUserId);
    }
  }
);
  mNone=(TextView)findViewById(R.id.api_select_sign_key_none);
  mNone.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mData.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID,0);
      setResult(Activity.RESULT_OK,mData);
      finish();
    }
  }
);
  Intent intent=getIntent();
  mAppUri=intent.getData();
  mPreferredUserId=intent.getStringExtra(EXTRA_USER_ID);
  mData=intent.getParcelableExtra(EXTRA_DATA);
  if (mAppUri == null) {
    Log.e(Constants.TAG,"String_Node_Str");
    finish();
    return;
  }
 else {
    Log.d(Constants.TAG,"String_Node_Str" + mAppUri);
    startListFragments(savedInstanceState,mAppUri,mData);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setFullScreenDialogClose(new View.OnClickListener(){
    @Override public void onClick(    View v){
      setResult(RESULT_CANCELED);
      finish();
    }
  }
);
  TextView createKeyButton=(TextView)findViewById(R.id.api_select_sign_key_create_key);
  createKeyButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      createKey(mPreferredUserId);
    }
  }
);
  TextView noneButton=(TextView)findViewById(R.id.api_select_sign_key_none);
  noneButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mData.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID,0);
      setResult(Activity.RESULT_OK,mData);
      finish();
    }
  }
);
  Intent intent=getIntent();
  Uri appUri=intent.getData();
  mPreferredUserId=intent.getStringExtra(EXTRA_USER_ID);
  mData=intent.getParcelableExtra(EXTRA_DATA);
  if (appUri == null) {
    Log.e(Constants.TAG,"String_Node_Str");
    finish();
    return;
  }
 else {
    Log.d(Constants.TAG,"String_Node_Str" + appUri);
    startListFragments(savedInstanceState,appUri,mData);
  }
}
Program: 8273
Project: 8273
Buggy source:
private void startListFragments(Bundle savedInstanceState,Uri dataUri,Intent data){
  if (savedInstanceState != null) {
    return;
  }
  mListFragment=SelectSignKeyIdListFragment.newInstance(dataUri,data);
  getSupportFragmentManager().beginTransaction().replace(R.id.api_select_sign_key_list_fragment,mListFragment).commitAllowingStateLoss();
  getSupportFragmentManager().executePendingTransactions();
}

Fixed version (ground truth):
private void startListFragments(Bundle savedInstanceState,Uri dataUri,Intent data){
  if (savedInstanceState != null) {
    return;
  }
  SelectSignKeyIdListFragment listFragment=SelectSignKeyIdListFragment.newInstance(dataUri,data);
  getSupportFragmentManager().beginTransaction().replace(R.id.api_select_sign_key_list_fragment,listFragment).commitAllowingStateLoss();
  getSupportFragmentManager().executePendingTransactions();
}
Program: 8274
Project: 8274
Buggy source:
/** 
 * Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created.
 */
@Override public void onCreate(){
  super.onCreate();
  Security.insertProviderAt(new BouncyCastleProvider(),1);
  PRNGFixes.apply();
  Log.d(Constants.TAG,"String_Node_Str");
  if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
    if (!Constants.Path.APP_DIR.exists() && !Constants.Path.APP_DIR.mkdirs()) {
    }
  }
  brandGlowEffect(getApplicationContext(),FormattingUtils.getColorFromAttr(getApplicationContext(),R.attr.colorPrimary));
  setupAccountAsNeeded(this);
  Preferences.getPreferences(this).upgradePreferences();
  TlsHelper.addStaticCA("String_Node_Str",getAssets(),"String_Node_Str");
  TemporaryStorageProvider.cleanUp(this);
  if (!checkConsolidateRecovery()) {
    new KeychainDatabase(this).getReadableDatabase().close();
  }
}

Fixed version (ground truth):
/** 
 * Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created.
 */
@Override public void onCreate(){
  super.onCreate();
  Security.insertProviderAt(new BouncyCastleProvider(),1);
  PRNGFixes.apply();
  Log.d(Constants.TAG,"String_Node_Str");
  if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
    if (!Constants.Path.APP_DIR.exists() && !Constants.Path.APP_DIR.mkdirs()) {
    }
  }
  brandGlowEffect(getApplicationContext(),FormattingUtils.getColorFromAttr(getApplicationContext(),R.attr.colorPrimary));
  setupAccountAsNeeded(this);
  Preferences.getPreferences(this).upgradePreferences(this);
  TlsHelper.addStaticCA("String_Node_Str",getAssets(),"String_Node_Str");
  TemporaryStorageProvider.cleanUp(this);
  if (!checkConsolidateRecovery()) {
    new KeychainDatabase(this).getReadableDatabase().close();
  }
}
Program: 8275
Project: 8275
Buggy source:
/** 
 * Add OpenKeychain account to Android to link contacts with keys and keyserver sync
 */
public static void setupAccountAsNeeded(Context context){
  try {
    AccountManager manager=AccountManager.get(context);
    Account[] accounts=manager.getAccountsByType(Constants.ACCOUNT_TYPE);
    if (accounts.length == 0) {
      Account account=new Account(Constants.ACCOUNT_NAME,Constants.ACCOUNT_TYPE);
      if (manager.addAccountExplicitly(account,null,null)) {
        ContentResolver.setIsSyncable(account,ContactsContract.AUTHORITY,1);
        ContentResolver.setSyncAutomatically(account,ContactsContract.AUTHORITY,true);
        ContentResolver.setIsSyncable(account,Constants.PROVIDER_AUTHORITY,1);
        ContentResolver.setSyncAutomatically(account,Constants.PROVIDER_AUTHORITY,true);
        Log.e("String_Node_Str","String_Node_Str");
        ContentResolver.addPeriodicSync(new Account(Constants.ACCOUNT_NAME,Constants.ACCOUNT_TYPE),Constants.PROVIDER_AUTHORITY,new Bundle(),60);
      }
 else {
        Log.e(Constants.TAG,"String_Node_Str");
      }
    }
  }
 catch (  SecurityException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
    Toast.makeText(context,R.string.reinstall_openkeychain,Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
/** 
 * Add OpenKeychain account to Android to link contacts with keys and keyserver sync
 */
public static void setupAccountAsNeeded(Context context){
  try {
    AccountManager manager=AccountManager.get(context);
    Account[] accounts=manager.getAccountsByType(Constants.ACCOUNT_TYPE);
    if (accounts.length == 0) {
      Account account=new Account(Constants.ACCOUNT_NAME,Constants.ACCOUNT_TYPE);
      if (manager.addAccountExplicitly(account,null,null)) {
        ContentResolver.setIsSyncable(account,ContactsContract.AUTHORITY,1);
        ContentResolver.setSyncAutomatically(account,ContactsContract.AUTHORITY,true);
        KeyserverSyncAdapterService.enableKeyserverSync(context);
      }
 else {
        Log.e(Constants.TAG,"String_Node_Str");
      }
    }
  }
 catch (  SecurityException e) {
    Log.e(Constants.TAG,"String_Node_Str",e);
    Toast.makeText(context,R.string.reinstall_openkeychain,Toast.LENGTH_LONG).show();
  }
}
Program: 8276
Project: 8276
Buggy source:
@Override public String get(String keyIdHex,Proxy proxy) throws QueryFailedException {
  String request="String_Node_Str" + keyIdHex;
  Log.d(Constants.TAG,"String_Node_Str" + request + "String_Node_Str"+ proxy);
  String data;
  try {
    data=query(request,proxy);
  }
 catch (  HttpError httpError) {
    Log.e(Constants.TAG,"String_Node_Str",httpError);
    throw new QueryFailedException("String_Node_Str");
  }
  Matcher matcher=PgpHelper.PGP_PUBLIC_KEY.matcher(data);
  if (matcher.find()) {
    return matcher.group(1);
  }
  return null;
}

Fixed version (ground truth):
@Override public String get(String keyIdHex,Proxy proxy) throws QueryFailedException {
  String request="String_Node_Str" + keyIdHex;
  Log.d(Constants.TAG,"String_Node_Str" + request + "String_Node_Str"+ proxy);
  String data;
  try {
    data=query(request,proxy);
  }
 catch (  HttpError httpError) {
    Log.d(Constants.TAG,"String_Node_Str",httpError);
    throw new QueryFailedException("String_Node_Str");
  }
  Matcher matcher=PgpHelper.PGP_PUBLIC_KEY.matcher(data);
  if (matcher.find()) {
    return matcher.group(1);
  }
  return null;
}
Program: 8281
Project: 8281
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case OrbotRequiredDialogActivity.MESSAGE_ORBOT_STARTED:
{
      Log.e("String_Node_Str","String_Node_Str");
      asyncKeyUpdate(KeyserverSyncAdapterService.this,new CryptoInputParcel());
      break;
    }
case OrbotRequiredDialogActivity.MESSAGE_ORBOT_IGNORE:
{
    asyncKeyUpdate(KeyserverSyncAdapterService.this,new CryptoInputParcel(ParcelableProxy.getForNoProxy()));
    break;
  }
case OrbotRequiredDialogActivity.MESSAGE_DIALOG_CANCEL:
{
  stopSelf();
  break;
}
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case OrbotRequiredDialogActivity.MESSAGE_ORBOT_STARTED:
{
      asyncKeyUpdate(KeyserverSyncAdapterService.this,new CryptoInputParcel());
      break;
    }
case OrbotRequiredDialogActivity.MESSAGE_ORBOT_IGNORE:
{
    asyncKeyUpdate(KeyserverSyncAdapterService.this,new CryptoInputParcel(ParcelableProxy.getForNoProxy()));
    break;
  }
case OrbotRequiredDialogActivity.MESSAGE_DIALOG_CANCEL:
{
  stopSelf();
  break;
}
}
}
Program: 8283
Project: 8283
Buggy source:
private void asyncKeyUpdate(final Context context,final CryptoInputParcel cryptoInputParcel){
  Log.e("String_Node_Str","String_Node_Str");
  new Thread(new Runnable(){
    @Override public void run(){
      ImportKeyResult result=updateKeysFromKeyserver(context,cryptoInputParcel);
      handleUpdateResult(result);
    }
  }
).start();
}

Fixed version (ground truth):
private void asyncKeyUpdate(final Context context,final CryptoInputParcel cryptoInputParcel){
  new Thread(new Runnable(){
    @Override public void run(){
      ImportKeyResult result=updateKeysFromKeyserver(context,cryptoInputParcel);
      handleUpdateResult(result);
    }
  }
).start();
}
Program: 8284
Project: 8284
Buggy source:
private void handleUpdateResult(ImportKeyResult result){
  if (result.isPending()) {
    Log.e(Constants.TAG,"String_Node_Str" + result.getRequiredInputParcel().mType);
    new OrbotHelper.SilentStartManager(){
      @Override protected void onOrbotStarted(){
        asyncKeyUpdate(KeyserverSyncAdapterService.this,new CryptoInputParcel());
      }
      @Override protected void onSilentStartDisabled(){
        NotificationManager manager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
        manager.notify(Constants.Notification.KEYSERVER_SYNC_FAIL_ORBOT,getOrbotNoification(KeyserverSyncAdapterService.this));
      }
    }
.startOrbotAndListen(this,false);
  }
 else   if (isUpdateCancelled()) {
    Log.d(Constants.TAG,"String_Node_Str");
    postponeSync();
  }
 else {
    Log.d(Constants.TAG,"String_Node_Str" + result.mUpdatedKeys + "String_Node_Str"+ result.mBadKeys);
    stopSelf();
  }
}

Fixed version (ground truth):
private void handleUpdateResult(ImportKeyResult result){
  if (result.isPending()) {
    new OrbotHelper.SilentStartManager(){
      @Override protected void onOrbotStarted(){
        asyncKeyUpdate(KeyserverSyncAdapterService.this,new CryptoInputParcel());
      }
      @Override protected void onSilentStartDisabled(){
        NotificationManager manager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
        manager.notify(Constants.Notification.KEYSERVER_SYNC_FAIL_ORBOT,getOrbotNoification(KeyserverSyncAdapterService.this));
      }
    }
.startOrbotAndListen(this,false);
  }
 else   if (isUpdateCancelled()) {
    Log.d(Constants.TAG,"String_Node_Str" + SYNC_POSTPONE_TIME + "String_Node_Str");
    postponeSync();
  }
 else {
    Log.d(Constants.TAG,"String_Node_Str" + result.mUpdatedKeys + "String_Node_Str"+ result.mBadKeys);
    stopSelf();
  }
}
Program: 8286
Project: 8286
Buggy source:
private void postponeSync(){
  AlarmManager alarmManager=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  Intent serviceIntent=new Intent(this,KeyserverSyncAdapterService.class);
  serviceIntent.setAction(ACTION_SYNC_NOW);
  PendingIntent pi=PendingIntent.getService(this,0,serviceIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + 30 * 1000,pi);
}

Fixed version (ground truth):
private void postponeSync(){
  AlarmManager alarmManager=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  Intent serviceIntent=new Intent(this,KeyserverSyncAdapterService.class);
  serviceIntent.setAction(ACTION_SYNC_NOW);
  PendingIntent pi=PendingIntent.getService(this,0,serviceIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + SYNC_POSTPONE_TIME,pi);
}