Program: 8388
Project: 8388
Buggy source:
private void encryptStart(){
  Intent intent=new Intent(this,KeychainIntentService.class);
  Bundle data=new Bundle();
  boolean useAsciiArmor=true;
  long encryptionKeyIds[]=null;
  int compressionId=0;
  boolean signOnly=false;
  long mSecretKeyIdToPass=0;
  if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
    Log.d(Constants.TAG,"String_Node_Str");
    String passphrase=mPassphrase.getText().toString();
    if (passphrase.length() == 0) {
      passphrase=null;
    }
    data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE,passphrase);
  }
 else {
    mSecretKeyIdToPass=mSecretKeyId;
    encryptionKeyIds=mEncryptionKeyIds;
    signOnly=(mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0);
  }
  intent.setAction(KeychainIntentService.ACTION_ENCRYPT_SIGN);
  if (mEncryptTarget == Id.target.file) {
    useAsciiArmor=mAsciiArmor.isChecked();
    compressionId=((Choice)mFileCompression.getSelectedItem()).getId();
    data.putInt(KeychainIntentService.TARGET,KeychainIntentService.TARGET_URI);
    Log.d(Constants.TAG,"String_Node_Str" + mInputFilename + "String_Node_Str"+ mOutputFilename);
    data.putString(KeychainIntentService.ENCRYPT_INPUT_FILE,mInputFilename);
    data.putString(KeychainIntentService.ENCRYPT_OUTPUT_FILE,mOutputFilename);
  }
 else {
    useAsciiArmor=true;
    compressionId=Preferences.getPreferences(this).getDefaultMessageCompression();
    data.putInt(KeychainIntentService.TARGET,KeychainIntentService.TARGET_BYTES);
    String message=mMessage.getText().toString();
    if (signOnly) {
      fixBadCharactersForGmail(message);
    }
    data.putByteArray(KeychainIntentService.ENCRYPT_MESSAGE_BYTES,message.getBytes());
  }
  if (mOverrideAsciiArmor) {
    useAsciiArmor=mAsciiArmorDemand;
  }
  data.putLong(KeychainIntentService.ENCRYPT_SECRET_KEY_ID,mSecretKeyIdToPass);
  data.putBoolean(KeychainIntentService.ENCRYPT_USE_ASCII_ARMOR,useAsciiArmor);
  data.putLongArray(KeychainIntentService.ENCRYPT_ENCRYPTION_KEYS_IDS,encryptionKeyIds);
  data.putInt(KeychainIntentService.ENCRYPT_COMPRESSION_ID,compressionId);
  data.putBoolean(KeychainIntentService.ENCRYPT_GENERATE_SIGNATURE,mGenerateSignature);
  data.putBoolean(KeychainIntentService.ENCRYPT_SIGN_ONLY,signOnly);
  intent.putExtra(KeychainIntentService.EXTRA_DATA,data);
  KeychainIntentServiceHandler saveHandler=new KeychainIntentServiceHandler(this,R.string.progress_encrypting,ProgressDialog.STYLE_HORIZONTAL){
    public void handleMessage(    Message message){
      super.handleMessage(message);
      if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
        Bundle data=message.getData();
        String output;
switch (mEncryptTarget) {
case Id.target.clipboard:
          output=data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
        Log.d(Constants.TAG,"String_Node_Str" + output);
      ClipboardReflection.copyToClipboard(EncryptActivity.this,output);
    AppMsg.makeText(EncryptActivity.this,R.string.encryption_to_clipboard_successful,AppMsg.STYLE_INFO).show();
  break;
case Id.target.email:
output=data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
Log.d(Constants.TAG,"String_Node_Str" + output);
Intent sendIntent=new Intent(Intent.ACTION_SEND);
sendIntent.setType("String_Node_Str");
sendIntent.putExtra(Intent.EXTRA_TEXT,output);
startActivity(Intent.createChooser(sendIntent,getString(R.string.title_send_email)));
break;
case Id.target.file:
AppMsg.makeText(EncryptActivity.this,R.string.encryption_successful,AppMsg.STYLE_INFO).show();
if (mDeleteAfter.isChecked()) {
DeleteFileDialogFragment deleteFileDialog=DeleteFileDialogFragment.newInstance(mInputFilename);
deleteFileDialog.show(getSupportFragmentManager(),"String_Node_Str");
}
if (mShareAfter.isChecked()) {
Intent sendFileIntent=new Intent(Intent.ACTION_SEND);
sendFileIntent.setType("String_Node_Str");
sendFileIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(mOutputFilename));
startActivity(Intent.createChooser(sendFileIntent,getString(R.string.title_send_file)));
}
break;
default :
break;
}
}
}
}
;
Messenger messenger=new Messenger(saveHandler);
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER,messenger);
saveHandler.showProgressDialog(this);
startService(intent);
}

Fixed version (ground truth):
private void encryptStart(){
  Intent intent=new Intent(this,KeychainIntentService.class);
  Bundle data=new Bundle();
  boolean useAsciiArmor=true;
  long encryptionKeyIds[]=null;
  int compressionId=0;
  boolean signOnly=false;
  long mSecretKeyIdToPass=0;
  if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
    Log.d(Constants.TAG,"String_Node_Str");
    String passphrase=mPassphrase.getText().toString();
    if (passphrase.length() == 0) {
      passphrase=null;
    }
    data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE,passphrase);
  }
 else {
    mSecretKeyIdToPass=mSecretKeyId;
    encryptionKeyIds=mEncryptionKeyIds;
    signOnly=(mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0);
  }
  intent.setAction(KeychainIntentService.ACTION_ENCRYPT_SIGN);
  if (mEncryptTarget == Id.target.file) {
    useAsciiArmor=mAsciiArmor.isChecked();
    compressionId=((Choice)mFileCompression.getSelectedItem()).getId();
    data.putInt(KeychainIntentService.TARGET,KeychainIntentService.TARGET_URI);
    Log.d(Constants.TAG,"String_Node_Str" + mInputFilename + "String_Node_Str"+ mOutputFilename);
    data.putString(KeychainIntentService.ENCRYPT_INPUT_FILE,mInputFilename);
    data.putString(KeychainIntentService.ENCRYPT_OUTPUT_FILE,mOutputFilename);
  }
 else {
    useAsciiArmor=true;
    compressionId=Preferences.getPreferences(this).getDefaultMessageCompression();
    data.putInt(KeychainIntentService.TARGET,KeychainIntentService.TARGET_BYTES);
    String message=mMessage.getText().toString();
    if (signOnly) {
      fixBadCharactersForGmail(message);
    }
    data.putByteArray(KeychainIntentService.ENCRYPT_MESSAGE_BYTES,message.getBytes());
  }
  if (mOverrideAsciiArmor) {
    useAsciiArmor=mAsciiArmorDemand;
  }
  data.putLong(KeychainIntentService.ENCRYPT_SECRET_KEY_ID,mSecretKeyIdToPass);
  data.putBoolean(KeychainIntentService.ENCRYPT_USE_ASCII_ARMOR,useAsciiArmor);
  data.putLongArray(KeychainIntentService.ENCRYPT_ENCRYPTION_KEYS_IDS,encryptionKeyIds);
  data.putInt(KeychainIntentService.ENCRYPT_COMPRESSION_ID,compressionId);
  data.putBoolean(KeychainIntentService.ENCRYPT_GENERATE_SIGNATURE,mGenerateSignature);
  data.putBoolean(KeychainIntentService.ENCRYPT_SIGN_ONLY,signOnly);
  intent.putExtra(KeychainIntentService.EXTRA_DATA,data);
  KeychainIntentServiceHandler saveHandler=new KeychainIntentServiceHandler(this,getString(R.string.progress_encrypting),ProgressDialog.STYLE_HORIZONTAL){
    public void handleMessage(    Message message){
      super.handleMessage(message);
      if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
        Bundle data=message.getData();
        String output;
switch (mEncryptTarget) {
case Id.target.clipboard:
          output=data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
        Log.d(Constants.TAG,"String_Node_Str" + output);
      ClipboardReflection.copyToClipboard(EncryptActivity.this,output);
    AppMsg.makeText(EncryptActivity.this,R.string.encryption_to_clipboard_successful,AppMsg.STYLE_INFO).show();
  break;
case Id.target.email:
output=data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING);
Log.d(Constants.TAG,"String_Node_Str" + output);
Intent sendIntent=new Intent(Intent.ACTION_SEND);
sendIntent.setType("String_Node_Str");
sendIntent.putExtra(Intent.EXTRA_TEXT,output);
startActivity(Intent.createChooser(sendIntent,getString(R.string.title_send_email)));
break;
case Id.target.file:
AppMsg.makeText(EncryptActivity.this,R.string.encryption_successful,AppMsg.STYLE_INFO).show();
if (mDeleteAfter.isChecked()) {
DeleteFileDialogFragment deleteFileDialog=DeleteFileDialogFragment.newInstance(mInputFilename);
deleteFileDialog.show(getSupportFragmentManager(),"String_Node_Str");
}
if (mShareAfter.isChecked()) {
Intent sendFileIntent=new Intent(Intent.ACTION_SEND);
sendFileIntent.setType("String_Node_Str");
sendFileIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(mOutputFilename));
startActivity(Intent.createChooser(sendFileIntent,getString(R.string.title_send_file)));
}
break;
default :
break;
}
}
}
}
;
Messenger messenger=new Messenger(saveHandler);
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER,messenger);
saveHandler.showProgressDialog(this);
startService(intent);
}