Program: 187883
Project: 187883
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (!EulaActivity.checkEula(this,getIntent())) {
    return;
  }
  Intent thisIntent=getIntent();
  boolean isLocal=thisIntent.getBooleanExtra(EXTRA_IS_LOCAL,false);
  if (debug)   Log.d(TAG,"String_Node_Str");
  dbHelper=new DBHelper(this);
  ch=new CryptoHelper(CryptoHelper.EncryptionStrong);
  if (dbHelper.needsUpgrade()) {
switch (dbHelper.fetchVersion()) {
case 2:
      databaseVersionError();
  }
}
setContentView(R.layout.front_door);
ImageView icon=(ImageView)findViewById(R.id.entry_icon);
icon.setImageResource(R.drawable.icon_safe);
TextView header=(TextView)findViewById(R.id.entry_header);
String version=VersionUtils.getVersionNumber(this);
String appName=VersionUtils.getApplicationName(this);
String head=appName + "String_Node_Str" + version+ "String_Node_Str";
header.setText(head);
pbeKey=(EditText)findViewById(R.id.password);
introText=(TextView)findViewById(R.id.first_time);
remoteAsk=(TextView)findViewById(R.id.remote);
confirmPass=(EditText)findViewById(R.id.pass_confirm);
confirmText=(TextView)findViewById(R.id.confirm_lbl);
salt=dbHelper.fetchSalt();
masterKey=dbHelper.fetchMasterKey();
if (masterKey.length() == 0) {
  firstTime=true;
  introText.setVisibility(View.VISIBLE);
  confirmText.setVisibility(View.VISIBLE);
  confirmPass.setVisibility(View.VISIBLE);
  checkForBackup();
}
if (!isLocal) {
  if (remoteAsk != null) {
    remoteAsk.setVisibility(View.VISIBLE);
  }
}
Button continueButton=(Button)findViewById(R.id.continue_button);
continueButton.setOnClickListener(new View.OnClickListener(){
  public void onClick(  View arg0){
    PBEKey=pbeKey.getText().toString();
    try {
      ch.setSalt(dbHelper.fetchSalt());
      ch.setPassword(PBEKey);
    }
 catch (    CryptoHelperException e2) {
      e2.printStackTrace();
      return;
    }
    if (PBEKey.length() < 4) {
      Toast.makeText(AskPassword.this,R.string.notify_blank_pass,Toast.LENGTH_SHORT).show();
      Animation shake=AnimationUtils.loadAnimation(AskPassword.this,R.anim.shake);
      findViewById(R.id.password).startAnimation(shake);
      return;
    }
    if (firstTime) {
      if (pbeKey.getText().toString().compareTo(confirmPass.getText().toString()) != 0) {
        Toast.makeText(AskPassword.this,R.string.confirm_pass_fail,Toast.LENGTH_SHORT).show();
        return;
      }
      try {
        salt=CryptoHelper.generateSalt();
        masterKey=CryptoHelper.generateMasterKey();
      }
 catch (      NoSuchAlgorithmException e1) {
        e1.printStackTrace();
      }
      if (debug)       Log.i(TAG,"String_Node_Str" + masterKey);
      try {
        ch.setSalt(salt);
        String encryptedMasterKey=ch.encrypt(masterKey);
        dbHelper.storeSalt(salt);
        dbHelper.storeMasterKey(encryptedMasterKey);
      }
 catch (      CryptoHelperException e) {
        Log.e(TAG,e.toString());
      }
    }
 else     if (!checkUserPassword()) {
      Toast.makeText(AskPassword.this,R.string.invalid_password,Toast.LENGTH_SHORT).show();
      Animation shake=AnimationUtils.loadAnimation(AskPassword.this,R.anim.shake);
      findViewById(R.id.password).startAnimation(shake);
      return;
    }
    Intent callbackIntent=new Intent();
    if (debug)     Log.d(TAG,"String_Node_Str" + masterKey + "String_Node_Str"+ salt);
    callbackIntent.putExtra("String_Node_Str",masterKey);
    callbackIntent.putExtra("String_Node_Str",salt);
    setResult(RESULT_OK,callbackIntent);
    finish();
  }
}
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (!EulaActivity.checkEula(this,getIntent())) {
    return;
  }
  Intent thisIntent=getIntent();
  boolean isLocal=thisIntent.getBooleanExtra(EXTRA_IS_LOCAL,false);
  if (debug)   Log.d(TAG,"String_Node_Str");
  dbHelper=new DBHelper(this);
  ch=new CryptoHelper(CryptoHelper.EncryptionStrong);
  if (dbHelper.needsUpgrade()) {
switch (dbHelper.fetchVersion()) {
case 2:
      databaseVersionError();
  }
}
setContentView(R.layout.front_door);
ImageView icon=(ImageView)findViewById(R.id.entry_icon);
icon.setImageResource(R.drawable.icon_safe);
TextView header=(TextView)findViewById(R.id.entry_header);
String version=VersionUtils.getVersionNumber(this);
String appName=VersionUtils.getApplicationName(this);
String head=appName + "String_Node_Str" + version+ "String_Node_Str";
header.setText(head);
pbeKey=(EditText)findViewById(R.id.password);
introText=(TextView)findViewById(R.id.first_time);
remoteAsk=(TextView)findViewById(R.id.remote);
confirmPass=(EditText)findViewById(R.id.pass_confirm);
confirmText=(TextView)findViewById(R.id.confirm_lbl);
salt=dbHelper.fetchSalt();
masterKey=dbHelper.fetchMasterKey();
if (masterKey.length() == 0) {
  firstTime=true;
  introText.setVisibility(View.VISIBLE);
  confirmText.setVisibility(View.VISIBLE);
  confirmPass.setVisibility(View.VISIBLE);
  checkForBackup();
}
if (!isLocal) {
  if (remoteAsk != null) {
    remoteAsk.setVisibility(View.VISIBLE);
  }
}
Button continueButton=(Button)findViewById(R.id.continue_button);
continueButton.setOnClickListener(new View.OnClickListener(){
  public void onClick(  View arg0){
    PBEKey=pbeKey.getText().toString();
    if (!firstTime) {
      try {
        ch.setSalt(dbHelper.fetchSalt());
        ch.setPassword(PBEKey);
      }
 catch (      CryptoHelperException e2) {
        e2.printStackTrace();
        return;
      }
    }
    if (PBEKey.length() < 4) {
      Toast.makeText(AskPassword.this,R.string.notify_blank_pass,Toast.LENGTH_SHORT).show();
      Animation shake=AnimationUtils.loadAnimation(AskPassword.this,R.anim.shake);
      findViewById(R.id.password).startAnimation(shake);
      return;
    }
    if (firstTime) {
      if (pbeKey.getText().toString().compareTo(confirmPass.getText().toString()) != 0) {
        Toast.makeText(AskPassword.this,R.string.confirm_pass_fail,Toast.LENGTH_SHORT).show();
        return;
      }
      try {
        salt=CryptoHelper.generateSalt();
        masterKey=CryptoHelper.generateMasterKey();
      }
 catch (      NoSuchAlgorithmException e1) {
        e1.printStackTrace();
      }
      if (debug)       Log.i(TAG,"String_Node_Str" + masterKey);
      try {
        ch.setSalt(salt);
        String encryptedMasterKey=ch.encrypt(masterKey);
        dbHelper.storeSalt(salt);
        dbHelper.storeMasterKey(encryptedMasterKey);
      }
 catch (      CryptoHelperException e) {
        Log.e(TAG,e.toString());
      }
    }
 else     if (!checkUserPassword()) {
      Toast.makeText(AskPassword.this,R.string.invalid_password,Toast.LENGTH_SHORT).show();
      Animation shake=AnimationUtils.loadAnimation(AskPassword.this,R.anim.shake);
      findViewById(R.id.password).startAnimation(shake);
      return;
    }
    Intent callbackIntent=new Intent();
    if (debug)     Log.d(TAG,"String_Node_Str" + masterKey + "String_Node_Str"+ salt);
    callbackIntent.putExtra("String_Node_Str",masterKey);
    callbackIntent.putExtra("String_Node_Str",salt);
    setResult(RESULT_OK,callbackIntent);
    finish();
  }
}
);
}