Program: 8419
Project: 8419
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.edit_key);
  mActionBar=getSupportActionBar();
  mActionBar.setDisplayShowTitleEnabled(true);
  OtherHelper.setActionBarBackButton(this);
  mChangePassPhrase=(Button)findViewById(R.id.edit_key_btn_change_pass_phrase);
  mNoPassphrase=(CheckBox)findViewById(R.id.edit_key_no_passphrase);
  mUserIds=new Vector<String>();
  mKeys=new Vector<PGPSecretKey>();
  mKeysUsages=new Vector<Integer>();
  mIntent=getIntent();
  Bundle extras=mIntent.getExtras();
  if (ACTION_CREATE_KEY.equals(mIntent.getAction())) {
    mActionBar.setTitle(R.string.title_createKey);
    mCurrentPassPhrase="String_Node_Str";
    if (extras != null) {
      if (extras.containsKey(EXTRA_USER_IDS)) {
        Log.d(Constants.TAG,"String_Node_Str");
        mUserIds.add(extras.getString(EXTRA_USER_IDS));
      }
      if (extras.containsKey(EXTRA_NO_PASSPHRASE)) {
        boolean noPassphrase=extras.getBoolean(EXTRA_NO_PASSPHRASE);
        if (noPassphrase) {
          mNoPassphrase.setChecked(true);
          mChangePassPhrase.setVisibility(View.GONE);
        }
      }
      if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) {
        boolean generateDefaultKeys=extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS);
        if (generateDefaultKeys) {
          mBuildLayout=false;
          Intent intent=new Intent(this,ApgService.class);
          intent.putExtra(ApgService.EXTRA_ACTION,ApgService.ACTION_GENERATE_DEFAULT_RSA_KEYS);
          Bundle data=new Bundle();
          data.putString(ApgService.SYMMETRIC_PASSPHRASE,mCurrentPassPhrase);
          intent.putExtra(ApgService.EXTRA_DATA,data);
          ApgServiceHandler saveHandler=new ApgServiceHandler(this,R.string.progress_generating,ProgressDialog.STYLE_SPINNER){
            public void handleMessage(            Message message){
              super.handleMessage(message);
              if (message.arg1 == ApgServiceHandler.MESSAGE_OKAY) {
                Bundle data=message.getData();
                PGPSecretKeyRing masterKeyRing=PGPConversionHelper.BytesToPGPSecretKeyRing(data.getByteArray(ApgService.RESULT_NEW_KEY));
                PGPSecretKeyRing subKeyRing=PGPConversionHelper.BytesToPGPSecretKeyRing(data.getByteArray(ApgService.RESULT_NEW_KEY2));
                @SuppressWarnings("String_Node_Str") Iterator<PGPSecretKey> masterIt=masterKeyRing.getSecretKeys();
                mKeys.add(masterIt.next());
                mKeysUsages.add(Id.choice.usage.sign_only);
                @SuppressWarnings("String_Node_Str") Iterator<PGPSecretKey> subIt=subKeyRing.getSecretKeys();
                subIt.next();
                mKeys.add(subIt.next());
                mKeysUsages.add(Id.choice.usage.encrypt_only);
                buildLayout();
              }
            }
          }
;
          Messenger messenger=new Messenger(saveHandler);
          intent.putExtra(ApgService.EXTRA_MESSENGER,messenger);
          saveHandler.showProgressDialog(this);
          startService(intent);
        }
      }
    }
  }
 else   if (ACTION_EDIT_KEY.equals(mIntent.getAction())) {
    mActionBar.setTitle(R.string.title_editKey);
    mCurrentPassPhrase=PGPMain.getEditPassPhrase();
    if (mCurrentPassPhrase == null) {
      mCurrentPassPhrase="String_Node_Str";
    }
    if (mCurrentPassPhrase.equals("String_Node_Str")) {
      mNoPassphrase.setChecked(true);
      mChangePassPhrase.setVisibility(View.GONE);
    }
    if (extras != null) {
      if (extras.containsKey(EXTRA_KEY_ID)) {
        long keyId=mIntent.getExtras().getLong(EXTRA_KEY_ID);
        if (keyId != 0) {
          PGPSecretKey masterKey=null;
          mKeyRing=PGPMain.getSecretKeyRing(keyId);
          if (mKeyRing != null) {
            masterKey=PGPHelper.getMasterKey(mKeyRing);
            for (            PGPSecretKey key : new IterableIterator<PGPSecretKey>(mKeyRing.getSecretKeys())) {
              mKeys.add(key);
              mKeysUsages.add(-1);
            }
          }
          if (masterKey != null) {
            for (            String userId : new IterableIterator<String>(masterKey.getUserIDs())) {
              mUserIds.add(userId);
            }
          }
        }
      }
    }
  }
  mChangePassPhrase.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showSetPassphraseDialog();
    }
  }
);
  mNoPassphrase.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      if (isChecked) {
        mNewPassPhrase=null;
        mChangePassPhrase.setVisibility(View.GONE);
      }
 else {
        mChangePassPhrase.setVisibility(View.VISIBLE);
      }
    }
  }
);
  if (mBuildLayout) {
    buildLayout();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.edit_key);
  mActionBar=getSupportActionBar();
  mActionBar.setDisplayShowTitleEnabled(true);
  OtherHelper.setActionBarBackButton(this);
  mChangePassPhrase=(Button)findViewById(R.id.edit_key_btn_change_pass_phrase);
  mNoPassphrase=(CheckBox)findViewById(R.id.edit_key_no_passphrase);
  mUserIds=new Vector<String>();
  mKeys=new Vector<PGPSecretKey>();
  mKeysUsages=new Vector<Integer>();
  Intent intent=getIntent();
  String action=intent.getAction();
  if (ACTION_CREATE_KEY.equals(action)) {
    handleActionCreateKey(intent);
  }
 else   if (ACTION_EDIT_KEY.equals(action)) {
    handleActionEditKey(intent);
  }
  mChangePassPhrase.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showSetPassphraseDialog();
    }
  }
);
  mNoPassphrase.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      if (isChecked) {
        mNewPassPhrase=null;
        mChangePassPhrase.setVisibility(View.GONE);
      }
 else {
        mChangePassPhrase.setVisibility(View.VISIBLE);
      }
    }
  }
);
  if (mBuildLayout) {
    buildLayout();
  }
}