Buggy code:
public class CommitsFragment extends BaseFragment implements ActionMode . Callback { private static final String IS_ACTION_MODE = "is<seq2seq4repair_space>action<seq2seq4repair_space>mode" ; private static final String CHOSEN_ITEM = "chosen<seq2seq4repair_space>item" ; private RepoDetailActivity mActivity ; private Button mCommitNameButton ; private ImageView mCommitType ; private ListView mCommitsList ; private CommitsListAdapter mCommitsListAdapter ; private ViewUtils mViewUtils ; private ActionMode mActionMode ; private Set < Integer > mChosenItem = new HashSet < Integer > ( ) ; private Repo mRepo ; public static CommitsFragment newInstance ( Repo mRepo ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { View v = inflater . inflate ( fragment_commits , container , false ) ; mActivity = ( ( RepoDetailActivity ) ( getActivity ( ) ) ) ; mActivity . setCommitsFragment ( this ) ; mViewUtils = ViewUtils . getInstance ( mActivity ) ; Bundle bundle = getArguments ( ) ; mRepo = ( ( Repo ) ( bundle . getSerializable ( TAG ) ) ) ; if ( ( ( mRepo ) == null ) && ( savedInstanceState != null ) ) { mRepo = ( ( Repo ) ( savedInstanceState . getSerializable ( TAG ) ) ) ; } if ( ( mRepo ) == null ) { return v ; } mRepo . setContext ( mActivity ) ; mCommitsList = ( ( ListView ) ( v . findViewById ( commitsList ) ) ) ; mCommitNameButton = ( ( Button ) ( v . findViewById ( commitName ) ) ) ; mCommitType = ( ( ImageView ) ( v . findViewById ( commitType ) ) ) ; mCommitsListAdapter = new CommitsListAdapter ( mActivity , mChosenItem , mRepo ) ; mCommitsListAdapter . resetCommit ( ) ; mCommitsList . setAdapter ( mCommitsListAdapter ) ; mCommitNameButton . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { <START_BUG> ChooseCommitDialog cbd = new ChooseCommitDialog ( ) ; <END_BUG> cbd . show ( getFragmentManager ( ) , "choose-branch-dialog" ) ; } } ) ; mCommitsList . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { @ Override public void onItemClick ( AdapterView < ? > adapterView , View view , int position , long id ) { if ( ( mActionMode ) == null ) { RevCommit commit = mCommitsListAdapter . getItem ( position ) ; final String fullCommitName = commit . getName ( ) ; String message = ( ( getString ( dialog_comfirm_checkout_commit_msg ) ) + "<seq2seq4repair_space>" ) + ( Repo . getCommitDisplayName ( fullCommitName ) ) ; mViewUtils . showMessageDialog ( dialog_comfirm_checkout_commit_title , message , label_checkout , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialogInterface , int i ) { mActivity . resetCommits ( fullCommitName ) ; } } ) ; return ; } chooseItem ( position ) ; } } ) ; mCommitsList . setOnItemLongClickListener ( new AdapterView . OnItemLongClickListener ( ) { @ Override public boolean onItemLongClick ( AdapterView < ? > adapterView , View view , int position , long l ) { if ( ( mActionMode ) != null ) { return false ; } enterDiffActionMode ( ) ; chooseItem ( position ) ; return true ; } } ) ; String branchName = mRepo . getBranchName ( ) ; reset ( branchName ) ; return v ; } @ Override public void onViewStateRestored ( Bundle savedInstanceState ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } @ Override public OnBackClickListener getOnBackClickListener ( ) { } public void reset ( String commitName ) { } public void reset ( ) { } public void enterDiffActionMode ( ) { } @ Override public boolean onCreateActionMode ( ActionMode actionMode , Menu menu ) { } @ Override public boolean onPrepareActionMode ( ActionMode actionMode , Menu menu ) { } @ Override public boolean onActionItemClicked ( ActionMode actionMode , MenuItem menuItem ) { } @ Override public void onDestroyActionMode ( ActionMode actionMode ) { } private void chooseItem ( int position ) { } }

Fix:
ChooseCommitDialog cbd = new ChooseCommitDialog ( mRepo ) ;