Program: 91211
Project: 91211
Buggy source:
@Override public View getView(final int position,View convertView,ViewGroup parent){
  View rowView=super.getView(position,convertView,parent);
  if (!isAdded()) {
    return rowView;
  }
  final TransactionSummary record=checkNotNull(getItem(position));
  final ActionBarActivity actionBarActivity=(ActionBarActivity)getActivity();
  rowView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    final View view){
      currentActionMode=actionBarActivity.startSupportActionMode(new ActionMode.Callback(){
        @Override public boolean onCreateActionMode(        ActionMode actionMode,        Menu menu){
          actionMode.getMenuInflater().inflate(R.menu.transaction_history_context_menu,menu);
          updateActionBar(actionMode,menu);
          return true;
        }
        @Override public boolean onPrepareActionMode(        ActionMode actionMode,        Menu menu){
          updateActionBar(actionMode,menu);
          return true;
        }
        private void updateActionBar(        ActionMode actionMode,        Menu menu){
          checkNotNull(menu.findItem(R.id.miAddToAddressBook)).setVisible(record.hasAddressBook());
          checkNotNull(menu.findItem(R.id.miCancelTransaction)).setVisible(record.canCancel());
          checkNotNull(menu.findItem(R.id.miShowDetails)).setVisible(record.hasDetails());
          checkNotNull(menu.findItem(R.id.miShowCoinapultDebug)).setVisible(record.canCoinapult());
          checkNotNull(menu.findItem(R.id.miRebroadcastTransaction)).setVisible((record.confirmations == 0) && !record.canCoinapult());
          checkNotNull(menu.findItem(R.id.miBumpFee)).setVisible((record.confirmations == 0) && !record.canCoinapult());
          checkNotNull(menu.findItem(R.id.miDeleteUnconfirmedTransaction)).setVisible(false);
          currentActionMode=actionMode;
          ((ListView)_root.findViewById(R.id.lvTransactionHistory)).setItemChecked(position,true);
        }
        @Override public boolean onActionItemClicked(        ActionMode actionMode,        MenuItem menuItem){
          final int itemId=menuItem.getItemId();
          if (itemId == R.id.miShowCoinapultDebug) {
            if (record instanceof CoinapultTransactionSummary) {
              final CoinapultTransactionSummary summary=(CoinapultTransactionSummary)record;
              new AlertDialog.Builder(_context).setMessage(summary.input.toString()).setNeutralButton(R.string.copy,new DialogInterface.OnClickListener(){
                @Override public void onClick(                DialogInterface dialog,                int which){
                  Utils.setClipboardString(summary.input.toString(),TransactionHistoryFragment.this.getActivity());
                  Toast.makeText(TransactionHistoryFragment.this.getActivity(),R.string.copied_to_clipboard,Toast.LENGTH_SHORT).show();
                  dialog.dismiss();
                }
              }
).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
                @Override public void onClick(                DialogInterface dialog,                int which){
                  dialog.dismiss();
                }
              }
).show();
            }
            return true;
          }
switch (itemId) {
case R.id.miShowDetails:
            doShowDetails(record);
          finishActionMode();
        return true;
case R.id.miSetLabel:
      setTransactionLabel(record);
    finishActionMode();
  break;
case R.id.miAddToAddressBook:
EnterAddressLabelUtil.enterAddressLabel(getActivity(),_mbwManager.getMetadataStorage(),record.destinationAddress.get(),"String_Node_Str",addressLabelChanged);
break;
case R.id.miCancelTransaction:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.remove_queued_transaction_title)).setMessage(_context.getString(R.string.remove_queued_transaction)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
boolean okay=_mbwManager.getSelectedAccount().cancelQueuedTransaction(record.txid);
dialog.dismiss();
updateTransactionHistory();
if (okay) {
  Utils.showSimpleMessageDialog(getActivity(),_context.getString(R.string.remove_queued_transaction_hint));
}
 else {
  new Toaster(getActivity()).toast(_context.getString(R.string.remove_queued_transaction_error),false);
}
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
case R.id.miDeleteUnconfirmedTransaction:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.delete_unconfirmed_transaction_title)).setMessage(_context.getString(R.string.warning_delete_unconfirmed_transaction)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
_mbwManager.getSelectedAccount().deleteTransaction(record.txid);
dialog.dismiss();
updateTransactionHistory();
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
case R.id.miRebroadcastTransaction:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.rebroadcast_transaction_title)).setMessage(_context.getString(R.string.description_rebroadcast_transaction)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
boolean success=BroadcastTransactionActivity.callMe(getActivity(),_mbwManager.getSelectedAccount(),record.txid);
if (!success) {
Utils.showSimpleMessageDialog(getActivity(),_context.getString(R.string.message_rebroadcast_successfull));
}
dialog.dismiss();
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
case R.id.miBumpFee:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.bump_fee_title)).setMessage(_context.getString(R.string.description_bump_fee)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
Intent intent=SendMainActivity.getIntent(getActivity(),_mbwManager.getSelectedAccount().getId(),record.txid,false);
startActivity(intent);
dialog.dismiss();
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
}
return false;
}
@Override public void onDestroyActionMode(ActionMode actionMode){
((ListView)_root.findViewById(R.id.lvTransactionHistory)).setItemChecked(position,false);
currentActionMode=null;
}
}
);
}
}
);
return rowView;
}

Fixed version (ground truth):
@Override public View getView(final int position,View convertView,ViewGroup parent){
  View rowView=super.getView(position,convertView,parent);
  if (!isAdded()) {
    return rowView;
  }
  final TransactionSummary record=checkNotNull(getItem(position));
  final ActionBarActivity actionBarActivity=(ActionBarActivity)getActivity();
  rowView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    final View view){
      currentActionMode=actionBarActivity.startSupportActionMode(new ActionMode.Callback(){
        @Override public boolean onCreateActionMode(        ActionMode actionMode,        Menu menu){
          actionMode.getMenuInflater().inflate(R.menu.transaction_history_context_menu,menu);
          updateActionBar(actionMode,menu);
          return true;
        }
        @Override public boolean onPrepareActionMode(        ActionMode actionMode,        Menu menu){
          updateActionBar(actionMode,menu);
          return true;
        }
        private void updateActionBar(        ActionMode actionMode,        Menu menu){
          checkNotNull(menu.findItem(R.id.miAddToAddressBook)).setVisible(record.hasAddressBook());
          checkNotNull(menu.findItem(R.id.miCancelTransaction)).setVisible(record.canCancel());
          checkNotNull(menu.findItem(R.id.miShowDetails)).setVisible(record.hasDetails());
          checkNotNull(menu.findItem(R.id.miShowCoinapultDebug)).setVisible(record.canCoinapult());
          checkNotNull(menu.findItem(R.id.miRebroadcastTransaction)).setVisible((record.confirmations == 0) && !record.canCoinapult());
          checkNotNull(menu.findItem(R.id.miBumpFee)).setVisible((record.confirmations == 0) && !record.canCoinapult());
          checkNotNull(menu.findItem(R.id.miDeleteUnconfirmedTransaction)).setVisible(false);
          currentActionMode=actionMode;
          ((ListView)_root.findViewById(R.id.lvTransactionHistory)).setItemChecked(position,true);
        }
        @Override public boolean onActionItemClicked(        ActionMode actionMode,        MenuItem menuItem){
          final int itemId=menuItem.getItemId();
          if (itemId == R.id.miShowCoinapultDebug) {
            if (record instanceof CoinapultTransactionSummary) {
              final CoinapultTransactionSummary summary=(CoinapultTransactionSummary)record;
              new AlertDialog.Builder(_context).setMessage(summary.input.toString()).setNeutralButton(R.string.copy,new DialogInterface.OnClickListener(){
                @Override public void onClick(                DialogInterface dialog,                int which){
                  Utils.setClipboardString(summary.input.toString(),TransactionHistoryFragment.this.getActivity());
                  Toast.makeText(TransactionHistoryFragment.this.getActivity(),R.string.copied_to_clipboard,Toast.LENGTH_SHORT).show();
                  dialog.dismiss();
                }
              }
).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
                @Override public void onClick(                DialogInterface dialog,                int which){
                  dialog.dismiss();
                }
              }
).show();
            }
            return true;
          }
switch (itemId) {
case R.id.miShowDetails:
            doShowDetails(record);
          finishActionMode();
        return true;
case R.id.miSetLabel:
      setTransactionLabel(record);
    finishActionMode();
  break;
case R.id.miAddToAddressBook:
EnterAddressLabelUtil.enterAddressLabel(getActivity(),_mbwManager.getMetadataStorage(),record.destinationAddress.get(),"String_Node_Str",addressLabelChanged);
break;
case R.id.miCancelTransaction:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.remove_queued_transaction_title)).setMessage(_context.getString(R.string.remove_queued_transaction)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
boolean okay=_mbwManager.getSelectedAccount().cancelQueuedTransaction(record.txid);
dialog.dismiss();
updateTransactionHistory();
if (okay) {
  Utils.showSimpleMessageDialog(getActivity(),_context.getString(R.string.remove_queued_transaction_hint));
}
 else {
  new Toaster(getActivity()).toast(_context.getString(R.string.remove_queued_transaction_error),false);
}
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
case R.id.miDeleteUnconfirmedTransaction:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.delete_unconfirmed_transaction_title)).setMessage(_context.getString(R.string.warning_delete_unconfirmed_transaction)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
_mbwManager.getSelectedAccount().deleteTransaction(record.txid);
dialog.dismiss();
updateTransactionHistory();
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
case R.id.miRebroadcastTransaction:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.rebroadcast_transaction_title)).setMessage(_context.getString(R.string.description_rebroadcast_transaction)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
boolean success=BroadcastTransactionActivity.callMe(getActivity(),_mbwManager.getSelectedAccount(),record.txid);
if (!success) {
Utils.showSimpleMessageDialog(getActivity(),_context.getString(R.string.message_rebroadcast_failed));
}
dialog.dismiss();
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
case R.id.miBumpFee:
new AlertDialog.Builder(getActivity()).setTitle(_context.getString(R.string.bump_fee_title)).setMessage(_context.getString(R.string.description_bump_fee)).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
Intent intent=SendMainActivity.getIntent(getActivity(),_mbwManager.getSelectedAccount().getId(),record.txid,false);
startActivity(intent);
dialog.dismiss();
}
}
).setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
@Override public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
).create().show();
break;
}
return false;
}
@Override public void onDestroyActionMode(ActionMode actionMode){
((ListView)_root.findViewById(R.id.lvTransactionHistory)).setItemChecked(position,false);
currentActionMode=null;
}
}
);
}
}
);
return rowView;
}