Program: 64766
Project: 64766
Buggy source:
/** 
 * Get the parameters from the intent (parameters sent from the caller). Also used for Tasker integration, for example.
 * @param savedInstanceState parameters
 */
private boolean handleIntent(Bundle savedInstanceState){
  Intent intent=getIntent();
  mIntentAction=intent.getAction();
  if (savedInstanceState == null) {
    int accountId=intent.getIntExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID,Constants.NOT_SET);
    if (accountId != Constants.NOT_SET) {
      mCommonFunctions.transactionEntity.setAccountId(accountId);
    }
    if (mIntentAction != null) {
      int transactionId=intent.getIntExtra(EditTransactionActivityConstants.KEY_TRANS_ID,Constants.NOT_SET);
switch (mIntentAction) {
case Intent.ACTION_EDIT:
        loadCheckingAccount(transactionId);
      break;
case Intent.ACTION_PASTE:
    loadCheckingAccount(transactionId);
  duplicateTransaction();
break;
case Intent.ACTION_INSERT:
mRecurringTransactionId=intent.getIntExtra(EditTransactionActivityConstants.KEY_BDID_ID,Constants.NOT_SET);
if (mRecurringTransactionId > Constants.NOT_SET) {
loadRecurringTransaction(mRecurringTransactionId);
}
}
}
}
if (mIntentAction.equals(Intent.ACTION_INSERT)) {
if (mCommonFunctions.transactionEntity.getStatus() == null) {
String defaultStatus=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString(getString(PreferenceConstants.PREF_DEFAULT_STATUS),"String_Node_Str");
mCommonFunctions.transactionEntity.setStatus(defaultStatus);
}
if ("String_Node_Str".equals(PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString(getString(PreferenceConstants.PREF_DEFAULT_PAYEE),"String_Node_Str"))) {
AsyncTask<Void,Void,Boolean> task=new AsyncTask<Void,Void,Boolean>(){
@Override protected Boolean doInBackground(Void... params){
try {
Core core=new Core(getApplicationContext());
Payee payee=core.getLastPayeeUsed();
if (payee != null && mCommonFunctions.transactionEntity.getPayeeId() == Constants.NOT_SET) {
mCommonFunctions.transactionEntity.setPayeeId(payee.getId());
mCommonFunctions.payeeName=payee.getName();
mCommonFunctions.transactionEntity.setCategoryId(payee.getCategoryId());
mCommonFunctions.transactionEntity.setSubcategoryId(payee.getSubcategoryId());
mCommonFunctions.loadCategoryName();
return Boolean.TRUE;
}
}
 catch (Exception e) {
ExceptionHandler handler=new ExceptionHandler(CheckingTransactionEditActivity.this,CheckingTransactionEditActivity.this);
handler.handle(e,"String_Node_Str");
}
return Boolean.FALSE;
}
@Override protected void onPostExecute(Boolean result){
super.onPostExecute(result);
if (result) {
try {
mCommonFunctions.refreshPayeeName();
mCommonFunctions.displayCategoryName();
}
 catch (Exception e) {
Log.e(EditTransactionActivityConstants.LOGCAT,e.getMessage());
}
}
}
}
;
task.execute();
}
externalIntegration(intent);
Integer account=mCommonFunctions.transactionEntity.getAccountId();
if (account == null || account == Constants.NOT_SET) {
AppSettings settings=new AppSettings(this);
Integer defaultAccountId=settings.getGeneralSettings().getDefaultAccountId();
if (defaultAccountId == null) {
new ExceptionHandler(this).showMessage(getString(R.string.default_account_not_set));
return false;
}
 else {
mCommonFunctions.transactionEntity.setAccountId(defaultAccountId);
}
}
}
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(Intent.ACTION_INSERT.equals(mIntentAction) ? R.string.new_transaction : R.string.edit_transaction);
}
return true;
}

Fixed version (ground truth):
/** 
 * Get the parameters from the intent (parameters sent from the caller). Also used for Tasker integration, for example.
 * @param savedInstanceState parameters
 */
private boolean handleIntent(Bundle savedInstanceState){
  Intent intent=getIntent();
  mIntentAction=intent.getAction();
  if (savedInstanceState == null) {
    int accountId=intent.getIntExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID,Constants.NOT_SET);
    if (accountId != Constants.NOT_SET) {
      mCommonFunctions.transactionEntity.setAccountId(accountId);
    }
    if (mIntentAction != null) {
      int transactionId=intent.getIntExtra(EditTransactionActivityConstants.KEY_TRANS_ID,Constants.NOT_SET);
switch (mIntentAction) {
case Intent.ACTION_EDIT:
        loadCheckingAccount(transactionId);
      break;
case Intent.ACTION_PASTE:
    loadCheckingAccount(transactionId);
  duplicateTransaction();
break;
case Intent.ACTION_INSERT:
mRecurringTransactionId=intent.getIntExtra(EditTransactionActivityConstants.KEY_BDID_ID,Constants.NOT_SET);
if (mRecurringTransactionId > Constants.NOT_SET) {
loadRecurringTransaction(mRecurringTransactionId);
}
}
}
}
if (mIntentAction.equals(Intent.ACTION_INSERT)) {
if (mCommonFunctions.transactionEntity.getStatus() == null) {
String defaultStatus=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString(getString(PreferenceConstants.PREF_DEFAULT_STATUS),"String_Node_Str");
mCommonFunctions.transactionEntity.setStatus(defaultStatus);
}
if ("String_Node_Str".equals(PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString(getString(PreferenceConstants.PREF_DEFAULT_PAYEE),"String_Node_Str"))) {
AsyncTask<Void,Void,Boolean> task=new AsyncTask<Void,Void,Boolean>(){
@Override protected Boolean doInBackground(Void... params){
try {
Core core=new Core(getApplicationContext());
Payee payee=core.getLastPayeeUsed();
if (payee != null && mCommonFunctions.transactionEntity.getPayeeId() == Constants.NOT_SET) {
mCommonFunctions.transactionEntity.setPayeeId(payee.getId());
mCommonFunctions.payeeName=payee.getName();
mCommonFunctions.transactionEntity.setCategoryId(payee.getCategoryId());
mCommonFunctions.transactionEntity.setSubcategoryId(payee.getSubcategoryId());
mCommonFunctions.loadCategoryName();
return Boolean.TRUE;
}
}
 catch (Exception e) {
ExceptionHandler handler=new ExceptionHandler(CheckingTransactionEditActivity.this,CheckingTransactionEditActivity.this);
handler.handle(e,"String_Node_Str");
}
return Boolean.FALSE;
}
@Override protected void onPostExecute(Boolean result){
super.onPostExecute(result);
if (result) {
try {
mCommonFunctions.showPayeeName();
mCommonFunctions.displayCategoryName();
}
 catch (Exception e) {
Log.e(EditTransactionActivityConstants.LOGCAT,e.getMessage());
}
}
}
}
;
task.execute();
}
externalIntegration(intent);
Integer account=mCommonFunctions.transactionEntity.getAccountId();
if (account == null || account == Constants.NOT_SET) {
AppSettings settings=new AppSettings(this);
Integer defaultAccountId=settings.getGeneralSettings().getDefaultAccountId();
if (defaultAccountId == null) {
new ExceptionHandler(this).showMessage(getString(R.string.default_account_not_set));
return false;
}
 else {
mCommonFunctions.transactionEntity.setAccountId(defaultAccountId);
}
}
}
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(Intent.ACTION_INSERT.equals(mIntentAction) ? R.string.new_transaction : R.string.edit_transaction);
}
return true;
}