Program: 8433
Project: 8433
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.encrypt);
  mSource=(ViewFlipper)findViewById(R.id.source);
  mSourceLabel=(TextView)findViewById(R.id.sourceLabel);
  mSourcePrevious=(ImageView)findViewById(R.id.sourcePrevious);
  mSourceNext=(ImageView)findViewById(R.id.sourceNext);
  mSourcePrevious.setClickable(true);
  mSourcePrevious.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_in));
      mSource.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_out));
      mSource.showPrevious();
      updateSource();
    }
  }
);
  mSourceNext.setClickable(true);
  OnClickListener nextSourceClickListener=new OnClickListener(){
    @Override public void onClick(    View v){
      mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_in));
      mSource.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_out));
      mSource.showNext();
      updateSource();
    }
  }
;
  mSourceNext.setOnClickListener(nextSourceClickListener);
  mSourceLabel.setClickable(true);
  mSourceLabel.setOnClickListener(nextSourceClickListener);
  mMode=(ViewFlipper)findViewById(R.id.mode);
  mModeLabel=(TextView)findViewById(R.id.modeLabel);
  mModePrevious=(ImageView)findViewById(R.id.modePrevious);
  mModeNext=(ImageView)findViewById(R.id.modeNext);
  mModePrevious.setClickable(true);
  mModePrevious.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_in));
      mMode.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_out));
      mMode.showPrevious();
      updateMode();
    }
  }
);
  OnClickListener nextModeClickListener=new OnClickListener(){
    @Override public void onClick(    View v){
      mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_in));
      mMode.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_out));
      mMode.showNext();
      updateMode();
    }
  }
;
  mModeNext.setOnClickListener(nextModeClickListener);
  mModeLabel.setClickable(true);
  mModeLabel.setOnClickListener(nextModeClickListener);
  mMessage=(EditText)findViewById(R.id.message);
  mSelectKeysButton=(Button)findViewById(R.id.btn_selectEncryptKeys);
  mEncryptButton=(Button)findViewById(R.id.btn_encrypt);
  mEncryptToClipboardButton=(Button)findViewById(R.id.btn_encryptToClipboard);
  mSign=(CheckBox)findViewById(R.id.sign);
  mMainUserId=(TextView)findViewById(R.id.mainUserId);
  mMainUserIdRest=(TextView)findViewById(R.id.mainUserIdRest);
  mPassPhrase=(EditText)findViewById(R.id.passPhrase);
  mPassPhraseAgain=(EditText)findViewById(R.id.passPhraseAgain);
  View tmp=findViewById(R.id.sourceFile);
  tmp.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
  int height=tmp.getMeasuredHeight();
  mMessage.setMinimumHeight(height);
  mFilename=(EditText)findViewById(R.id.filename);
  mBrowse=(ImageButton)findViewById(R.id.btn_browse);
  mBrowse.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      openFile();
    }
  }
);
  mFileCompression=(Spinner)findViewById(R.id.fileCompression);
  Choice[] choices=new Choice[]{new Choice(Id.choice.compression.none,getString(R.string.choice_none)),new Choice(Id.choice.compression.zip,"String_Node_Str"),new Choice(Id.choice.compression.bzip2,"String_Node_Str"),new Choice(Id.choice.compression.zlib,"String_Node_Str")};
  ArrayAdapter<Choice> adapter=new ArrayAdapter<Choice>(this,android.R.layout.simple_spinner_item,choices);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mFileCompression.setAdapter(adapter);
  int defaultFileCompression=getDefaultFileCompression();
  for (int i=0; i < choices.length; ++i) {
    if (choices[i].getId() == defaultFileCompression) {
      mFileCompression.setSelection(i);
      break;
    }
  }
  mDeleteAfter=(CheckBox)findViewById(R.id.deleteAfterEncryption);
  mAsciiArmour=(CheckBox)findViewById(R.id.asciiArmour);
  mAsciiArmour.setChecked(getDefaultAsciiArmour());
  mAsciiArmour.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View view){
      guessOutputFilename();
    }
  }
);
  mEncryptToClipboardButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      encryptToClipboardClicked();
    }
  }
);
  mEncryptButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      encryptClicked();
    }
  }
);
  mSelectKeysButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      selectPublicKeys();
    }
  }
);
  mSign.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      CheckBox checkBox=(CheckBox)v;
      if (checkBox.isChecked()) {
        selectSecretKey();
      }
 else {
        setSecretKeyId(Id.key.none);
        updateView();
      }
    }
  }
);
  mIntent=getIntent();
  if (Apg.Intent.ENCRYPT.equals(mIntent.getAction()) || Apg.Intent.ENCRYPT_FILE.equals(mIntent.getAction()) || Apg.Intent.ENCRYPT_AND_RETURN.equals(mIntent.getAction())) {
    Bundle extras=mIntent.getExtras();
    if (extras == null) {
      extras=new Bundle();
    }
    if (Apg.Intent.ENCRYPT_AND_RETURN.equals(mIntent.getAction())) {
      mReturnResult=true;
    }
    String data=extras.getString(Apg.EXTRA_DATA);
    mSendTo=extras.getString(Apg.EXTRA_SEND_TO);
    mSubject=extras.getString(Apg.EXTRA_SUBJECT);
    long signatureKeyId=extras.getLong(Apg.EXTRA_SIGNATURE_KEY_ID);
    long encryptionKeyIds[]=extras.getLongArray(Apg.EXTRA_ENCRYPTION_KEY_IDS);
    if (signatureKeyId != 0) {
      PGPSecretKeyRing keyRing=Apg.getSecretKeyRing(signatureKeyId);
      PGPSecretKey masterKey=null;
      if (keyRing != null) {
        masterKey=Apg.getMasterKey(keyRing);
        if (masterKey != null) {
          Vector<PGPSecretKey> signKeys=Apg.getUsableSigningKeys(keyRing);
          if (signKeys.size() > 0) {
            setSecretKeyId(masterKey.getKeyID());
          }
        }
      }
    }
    if (encryptionKeyIds != null) {
      Vector<Long> goodIds=new Vector<Long>();
      for (int i=0; i < encryptionKeyIds.length; ++i) {
        PGPPublicKeyRing keyRing=Apg.getPublicKeyRing(encryptionKeyIds[i]);
        PGPPublicKey masterKey=null;
        if (keyRing == null) {
          continue;
        }
        masterKey=Apg.getMasterKey(keyRing);
        if (masterKey == null) {
          continue;
        }
        Vector<PGPPublicKey> encryptKeys=Apg.getUsableEncryptKeys(keyRing);
        if (encryptKeys.size() == 0) {
          continue;
        }
        goodIds.add(masterKey.getKeyID());
      }
      if (goodIds.size() > 0) {
        mEncryptionKeyIds=new long[goodIds.size()];
        for (int i=0; i < goodIds.size(); ++i) {
          mEncryptionKeyIds[i]=goodIds.get(i);
        }
      }
    }
    if (Apg.Intent.ENCRYPT.equals(mIntent.getAction()) || Apg.Intent.ENCRYPT_AND_RETURN.equals(mIntent.getAction())) {
      if (data != null) {
        mMessage.setText(data);
      }
      mSource.setInAnimation(null);
      mSource.setOutAnimation(null);
      while (mSource.getCurrentView().getId() != R.id.sourceMessage) {
        mSource.showNext();
      }
    }
 else     if (Apg.Intent.ENCRYPT_FILE.equals(mIntent.getAction())) {
      mSource.setInAnimation(null);
      mSource.setOutAnimation(null);
      while (mSource.getCurrentView().getId() != R.id.sourceFile) {
        mSource.showNext();
      }
    }
  }
  updateView();
  updateSource();
  updateMode();
  if (mReturnResult) {
    mSourcePrevious.setClickable(false);
    mSourcePrevious.setEnabled(false);
    mSourcePrevious.setVisibility(View.INVISIBLE);
    mSourceNext.setClickable(false);
    mSourceNext.setEnabled(false);
    mSourceNext.setVisibility(View.INVISIBLE);
    mSourceLabel.setClickable(false);
    mSourceLabel.setEnabled(false);
    mEncryptToClipboardButton.setEnabled(false);
    mEncryptToClipboardButton.setVisibility(View.INVISIBLE);
    mEncryptButton.setText(R.string.btn_encrypt);
  }
  if (mMessage.getText().length() > 0 && ((mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0) || getSecretKeyId() != 0)) {
    encryptClicked();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.encrypt);
  mSource=(ViewFlipper)findViewById(R.id.source);
  mSourceLabel=(TextView)findViewById(R.id.sourceLabel);
  mSourcePrevious=(ImageView)findViewById(R.id.sourcePrevious);
  mSourceNext=(ImageView)findViewById(R.id.sourceNext);
  mSourcePrevious.setClickable(true);
  mSourcePrevious.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_in));
      mSource.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_out));
      mSource.showPrevious();
      updateSource();
    }
  }
);
  mSourceNext.setClickable(true);
  OnClickListener nextSourceClickListener=new OnClickListener(){
    @Override public void onClick(    View v){
      mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_in));
      mSource.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_out));
      mSource.showNext();
      updateSource();
    }
  }
;
  mSourceNext.setOnClickListener(nextSourceClickListener);
  mSourceLabel.setClickable(true);
  mSourceLabel.setOnClickListener(nextSourceClickListener);
  mMode=(ViewFlipper)findViewById(R.id.mode);
  mModeLabel=(TextView)findViewById(R.id.modeLabel);
  mModePrevious=(ImageView)findViewById(R.id.modePrevious);
  mModeNext=(ImageView)findViewById(R.id.modeNext);
  mModePrevious.setClickable(true);
  mModePrevious.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_in));
      mMode.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_right_out));
      mMode.showPrevious();
      updateMode();
    }
  }
);
  OnClickListener nextModeClickListener=new OnClickListener(){
    @Override public void onClick(    View v){
      mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_in));
      mMode.setOutAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,R.anim.push_left_out));
      mMode.showNext();
      updateMode();
    }
  }
;
  mModeNext.setOnClickListener(nextModeClickListener);
  mModeLabel.setClickable(true);
  mModeLabel.setOnClickListener(nextModeClickListener);
  mMessage=(EditText)findViewById(R.id.message);
  mSelectKeysButton=(Button)findViewById(R.id.btn_selectEncryptKeys);
  mEncryptButton=(Button)findViewById(R.id.btn_encrypt);
  mEncryptToClipboardButton=(Button)findViewById(R.id.btn_encryptToClipboard);
  mSign=(CheckBox)findViewById(R.id.sign);
  mMainUserId=(TextView)findViewById(R.id.mainUserId);
  mMainUserIdRest=(TextView)findViewById(R.id.mainUserIdRest);
  mPassPhrase=(EditText)findViewById(R.id.passPhrase);
  mPassPhraseAgain=(EditText)findViewById(R.id.passPhraseAgain);
  View tmp=findViewById(R.id.sourceFile);
  tmp.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
  int height=tmp.getMeasuredHeight();
  mMessage.setMinimumHeight(height);
  mFilename=(EditText)findViewById(R.id.filename);
  mBrowse=(ImageButton)findViewById(R.id.btn_browse);
  mBrowse.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      openFile();
    }
  }
);
  mFileCompression=(Spinner)findViewById(R.id.fileCompression);
  Choice[] choices=new Choice[]{new Choice(Id.choice.compression.none,getString(R.string.choice_none)),new Choice(Id.choice.compression.zip,"String_Node_Str"),new Choice(Id.choice.compression.bzip2,"String_Node_Str"),new Choice(Id.choice.compression.zlib,"String_Node_Str")};
  ArrayAdapter<Choice> adapter=new ArrayAdapter<Choice>(this,android.R.layout.simple_spinner_item,choices);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mFileCompression.setAdapter(adapter);
  int defaultFileCompression=getDefaultFileCompression();
  for (int i=0; i < choices.length; ++i) {
    if (choices[i].getId() == defaultFileCompression) {
      mFileCompression.setSelection(i);
      break;
    }
  }
  mDeleteAfter=(CheckBox)findViewById(R.id.deleteAfterEncryption);
  mAsciiArmour=(CheckBox)findViewById(R.id.asciiArmour);
  mAsciiArmour.setChecked(getDefaultAsciiArmour());
  mAsciiArmour.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View view){
      guessOutputFilename();
    }
  }
);
  mEncryptToClipboardButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      encryptToClipboardClicked();
    }
  }
);
  mEncryptButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      encryptClicked();
    }
  }
);
  mSelectKeysButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      selectPublicKeys();
    }
  }
);
  mSign.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      CheckBox checkBox=(CheckBox)v;
      if (checkBox.isChecked()) {
        selectSecretKey();
      }
 else {
        setSecretKeyId(Id.key.none);
        updateView();
      }
    }
  }
);
  mIntent=getIntent();
  if (Apg.Intent.ENCRYPT.equals(mIntent.getAction()) || Apg.Intent.ENCRYPT_FILE.equals(mIntent.getAction()) || Apg.Intent.ENCRYPT_AND_RETURN.equals(mIntent.getAction())) {
    Bundle extras=mIntent.getExtras();
    if (extras == null) {
      extras=new Bundle();
    }
    if (Apg.Intent.ENCRYPT_AND_RETURN.equals(mIntent.getAction())) {
      mReturnResult=true;
    }
    String data=extras.getString(Apg.EXTRA_DATA);
    mSendTo=extras.getString(Apg.EXTRA_SEND_TO);
    mSubject=extras.getString(Apg.EXTRA_SUBJECT);
    long signatureKeyId=extras.getLong(Apg.EXTRA_SIGNATURE_KEY_ID);
    long encryptionKeyIds[]=extras.getLongArray(Apg.EXTRA_ENCRYPTION_KEY_IDS);
    if (signatureKeyId != 0) {
      PGPSecretKeyRing keyRing=Apg.getSecretKeyRing(signatureKeyId);
      PGPSecretKey masterKey=null;
      if (keyRing != null) {
        masterKey=Apg.getMasterKey(keyRing);
        if (masterKey != null) {
          Vector<PGPSecretKey> signKeys=Apg.getUsableSigningKeys(keyRing);
          if (signKeys.size() > 0) {
            setSecretKeyId(masterKey.getKeyID());
          }
        }
      }
    }
    if (encryptionKeyIds != null) {
      Vector<Long> goodIds=new Vector<Long>();
      for (int i=0; i < encryptionKeyIds.length; ++i) {
        PGPPublicKeyRing keyRing=Apg.getPublicKeyRing(encryptionKeyIds[i]);
        PGPPublicKey masterKey=null;
        if (keyRing == null) {
          continue;
        }
        masterKey=Apg.getMasterKey(keyRing);
        if (masterKey == null) {
          continue;
        }
        Vector<PGPPublicKey> encryptKeys=Apg.getUsableEncryptKeys(keyRing);
        if (encryptKeys.size() == 0) {
          continue;
        }
        goodIds.add(masterKey.getKeyID());
      }
      if (goodIds.size() > 0) {
        mEncryptionKeyIds=new long[goodIds.size()];
        for (int i=0; i < goodIds.size(); ++i) {
          mEncryptionKeyIds[i]=goodIds.get(i);
        }
      }
    }
    if (Apg.Intent.ENCRYPT.equals(mIntent.getAction()) || Apg.Intent.ENCRYPT_AND_RETURN.equals(mIntent.getAction())) {
      if (data != null) {
        mMessage.setText(data);
      }
      mSource.setInAnimation(null);
      mSource.setOutAnimation(null);
      while (mSource.getCurrentView().getId() != R.id.sourceMessage) {
        mSource.showNext();
      }
    }
 else     if (Apg.Intent.ENCRYPT_FILE.equals(mIntent.getAction())) {
      mSource.setInAnimation(null);
      mSource.setOutAnimation(null);
      while (mSource.getCurrentView().getId() != R.id.sourceFile) {
        mSource.showNext();
      }
    }
  }
  updateView();
  updateSource();
  updateMode();
  if (mReturnResult) {
    mSourcePrevious.setClickable(false);
    mSourcePrevious.setEnabled(false);
    mSourcePrevious.setVisibility(View.INVISIBLE);
    mSourceNext.setClickable(false);
    mSourceNext.setEnabled(false);
    mSourceNext.setVisibility(View.INVISIBLE);
    mSourceLabel.setClickable(false);
    mSourceLabel.setEnabled(false);
    mEncryptToClipboardButton.setEnabled(false);
    mEncryptToClipboardButton.setVisibility(View.INVISIBLE);
    mEncryptButton.setText(R.string.btn_encrypt);
  }
  if (mReturnResult && mMessage.getText().length() > 0 && ((mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0) || getSecretKeyId() != 0)) {
    encryptClicked();
  }
}