Program: 86993
Project: 86993
Buggy source:
public void setUpPassphraseElements(){
  passphraseEditText=new EditText(getActivity());
  passphraseEditText.setLayoutParams(marginTopLayoutParams);
  passphraseConfirmationEditText=new EditText(getActivity());
  passphraseConfirmationEditText.setLayoutParams(marginTopLayoutParams);
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  passphraseEnterPatternTextView=new TextView(getActivity());
  passphraseEnterPatternTextView.setText(getString(R.string.text_view_enter_pattern));
  passphraseEnterPatternTextView.setMinHeight(listPreferredItemHeight);
  passphraseEnterPatternTextView.setGravity(Gravity.CENTER_VERTICAL);
  passphraseEnterPatternTextView.setPadding((int)getResources().getDimension(R.dimen.activity_vertical_margin),0,0,0);
  passphraseEnterPatternTextView.setTextAppearance(getActivity(),android.R.style.TextAppearance_DeviceDefault_Medium);
  passphraseEnterPatternTextView.setLayoutParams(params);
  passphraseEnterPatternTextView.setOnTouchListener(new TextViewTouchListener());
  passphraseEnterPatternTextView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intent patternIntent=new Intent(getActivity(),StorePattern.class);
      startActivityForResult(patternIntent,REQUEST_CREATE_PATTERN);
    }
  }
);
  final Card passphraseCard=new Card(getActivity());
  ViewToClickToExpand viewToClickToExpand=ViewToClickToExpand.builder().enableForExpandAction();
  passphraseCard.setViewToClickToExpand(viewToClickToExpand);
  PassphraseCardHeader passphraseCardHeader=new PassphraseCardHeader(getActivity(),new PassphraseCardHeader.InnerViewElementsSetUpListener(){
    @Override public void onInnerViewElementsSetUp(    PassphraseCardHeader header){
      header.setTitle(getString(R.string.text_view_passphrase));
      passphraseTypeSpinner=header.getSpinner();
      passphraseAdapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_spinner_dropdown_item,Passphrase.passphraseTypes);
      passphraseTypeSpinner.setAdapter(passphraseAdapter);
      passphraseTypeSpinner.setSelection(Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD);
      selectedPassphrasetype=Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD;
      passphraseTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
        @Override public void onItemSelected(        AdapterView<?> parent,        View view,        int position,        long id){
          passphraseEditText.setHint("String_Node_Str" + Passphrase.passphraseTypes[position]);
          passphraseConfirmationEditText.setHint("String_Node_Str" + Passphrase.passphraseTypes[position]);
          selectedPassphrasetype=position;
          if (position == Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD) {
            setPassphraseItemsEnabled(true);
            setPassphraseItemsVisible(true);
            setPatternTextViewVisible(false);
            passphraseEditText.setText("String_Node_Str");
            passphraseConfirmationEditText.setText("String_Node_Str");
            passphraseEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
            passphraseConfirmationEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
            passphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passphraseConfirmationEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            pattern=null;
            passphraseCard.doExpand();
          }
 else           if (position == Passphrase.INDEX_PASSPHRASE_TYPE_PIN) {
            setPassphraseItemsEnabled(true);
            setPassphraseItemsVisible(true);
            setPatternTextViewVisible(false);
            passphraseEditText.setText("String_Node_Str");
            passphraseConfirmationEditText.setText("String_Node_Str");
            passphraseEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_NUMBER);
            passphraseConfirmationEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_NUMBER);
            passphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passphraseConfirmationEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            pattern=null;
            passphraseCard.doExpand();
          }
 else           if (position == Passphrase.INDEX_PASSPHRASE_TYPE_PATTERN) {
            setPassphraseItemsEnabled(false);
            setPassphraseItemsVisible(false);
            setPatternTextViewVisible(true);
            passphraseCard.doExpand();
          }
 else           if (position == Passphrase.INDEX_PASSPHRASE_TYPE_NONE) {
            setPassphraseItemsEnabled(false);
            setPassphraseItemsVisible(false);
            setPatternTextViewVisible(false);
            pattern=null;
            passphraseCard.doCollapse();
          }
        }
        @Override public void onNothingSelected(        AdapterView<?> parent){
          passphraseTypeSpinner.setSelection(Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD);
          selectedPassphrasetype=Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD;
          setPassphraseItemsEnabled(true);
          setPassphraseItemsVisible(true);
          passphraseEditText.setText("String_Node_Str");
          passphraseConfirmationEditText.setText("String_Node_Str");
          passphraseEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
          passphraseConfirmationEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
          passphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
          passphraseConfirmationEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
          passphraseCard.doExpand();
        }
      }
);
    }
  }
);
  passphraseCard.addCardHeader(passphraseCardHeader);
  passphraseCard.addCardExpand(new CardPassphraseExpand(getActivity()));
  passphraseCardView.setCard(passphraseCard);
}

Fixed version (ground truth):
public void setUpPassphraseElements(){
  passphraseEditText=new EditText(getActivity());
  passphraseEditText.setLayoutParams(marginTopLayoutParams);
  passphraseConfirmationEditText=new EditText(getActivity());
  passphraseConfirmationEditText.setLayoutParams(marginTopLayoutParams);
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  final Card passphraseCard=new Card(getActivity());
  ViewToClickToExpand viewToClickToExpand=ViewToClickToExpand.builder().enableForExpandAction();
  passphraseCard.setViewToClickToExpand(viewToClickToExpand);
  PassphraseCardHeader passphraseCardHeader=new PassphraseCardHeader(getActivity(),new PassphraseCardHeader.InnerViewElementsSetUpListener(){
    @Override public void onInnerViewElementsSetUp(    PassphraseCardHeader header){
      header.setTitle(getString(R.string.text_view_passphrase));
      passphraseTypeSpinner=header.getSpinner();
      passphraseAdapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_spinner_dropdown_item,Passphrase.masterPassphraseTypes);
      passphraseTypeSpinner.setAdapter(passphraseAdapter);
      passphraseTypeSpinner.setSelection(Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD);
      selectedPassphrasetype=Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD;
      passphraseTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
        @Override public void onItemSelected(        AdapterView<?> parent,        View view,        int position,        long id){
          passphraseEditText.setHint("String_Node_Str" + Passphrase.passphraseTypes[position]);
          passphraseConfirmationEditText.setHint("String_Node_Str" + Passphrase.passphraseTypes[position]);
          selectedPassphrasetype=position;
          if (position == Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD) {
            setPassphraseItemsEnabled(true);
            setPassphraseItemsVisible(true);
            passphraseEditText.setText("String_Node_Str");
            passphraseConfirmationEditText.setText("String_Node_Str");
            passphraseEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
            passphraseConfirmationEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
            passphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passphraseConfirmationEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passphraseCard.doExpand();
          }
 else           if (position == Passphrase.INDEX_PASSPHRASE_TYPE_PIN) {
            setPassphraseItemsEnabled(true);
            setPassphraseItemsVisible(true);
            passphraseEditText.setText("String_Node_Str");
            passphraseConfirmationEditText.setText("String_Node_Str");
            passphraseEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_NUMBER);
            passphraseConfirmationEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_NUMBER);
            passphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passphraseConfirmationEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passphraseCard.doExpand();
          }
        }
        @Override public void onNothingSelected(        AdapterView<?> parent){
          passphraseTypeSpinner.setSelection(Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD);
          selectedPassphrasetype=Passphrase.INDEX_PASSPHRASE_TYPE_PASSWORD;
          setPassphraseItemsEnabled(true);
          setPassphraseItemsVisible(true);
          passphraseEditText.setText("String_Node_Str");
          passphraseConfirmationEditText.setText("String_Node_Str");
          passphraseEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
          passphraseConfirmationEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
          passphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
          passphraseConfirmationEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
          passphraseCard.doExpand();
        }
      }
);
    }
  }
);
  passphraseCard.addCardHeader(passphraseCardHeader);
  passphraseCard.addCardExpand(new CardPassphraseExpand(getActivity()));
  passphraseCardView.setCard(passphraseCard);
}