Program: 64756
Project: 64756
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  mContext=context.getApplicationContext();
  final BehaviourSettings behav_settings=new BehaviourSettings(mContext);
  final GeneralSettings gen_settings=new GeneralSettings(mContext);
  final AppSettings app_settings=new AppSettings(mContext);
  final PreferenceConstants prf_const=new PreferenceConstants();
  int baseCurencyID, fromCurrencyID, toCurrencyID;
  int baseAccountID, fromAccountID, toAccountID;
  String baseCurrencySymbl, fromAccCurrencySymbl, toAccCurrencySymbl;
  String baseAccountName, fromAccountName, toAccountName;
  try {
    if (behav_settings.getBankSmsTrans() == true) {
      Bundle bundle=intent.getExtras();
      SmsMessage[] msgs=null;
      String msgBody="String_Node_Str";
      String msgSender="String_Node_Str";
      if (bundle != null) {
        Object[] pdus=(Object[])bundle.get("String_Node_Str");
        msgs=new SmsMessage[pdus.length];
        for (int i=0; i < msgs.length; i++) {
          msgs[i]=SmsMessage.createFromPdu((byte[])pdus[i]);
          msgSender=msgs[i].getOriginatingAddress();
          msgBody+=msgs[i].getMessageBody().toString();
        }
        ITransactionEntity model=AccountTransaction.create();
        mCommon=new EditTransactionCommonFunctions(null,model,database);
        String[] key_credit_search={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
        String[] key_debit_search={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
        String transType="String_Node_Str";
        Boolean isDeposit=validateTransType(key_credit_search,msgBody.toLowerCase());
        Boolean isWithdrawal=validateTransType(key_debit_search,msgBody.toLowerCase());
        if (isDeposit == true) {
          if (isWithdrawal == true) {
            transType="String_Node_Str";
            String[] transCategory=getCategoryOrSubCategoryByName("String_Node_Str");
            if (!transCategory[0].isEmpty()) {
              mCommon.transactionEntity.setCategoryId(parseInt(transCategory[0]));
            }
            if (!transCategory[1].isEmpty()) {
              mCommon.transactionEntity.setSubcategoryId(parseInt(transCategory[1]));
            }
            mCommon.transactionEntity.setTransactionType(TransactionTypes.Transfer);
          }
 else {
            transType="String_Node_Str";
            String[] incomeCategory=getCategoryOrSubCategoryByName("String_Node_Str");
            if (!incomeCategory[0].isEmpty()) {
              mCommon.transactionEntity.setCategoryId(parseInt(incomeCategory[0]));
            }
            if (!incomeCategory[1].isEmpty()) {
              mCommon.transactionEntity.setSubcategoryId(parseInt(incomeCategory[1]));
            }
            mCommon.transactionEntity.setTransactionType(TransactionTypes.Deposit);
          }
          mCommon.payeeName="String_Node_Str";
        }
 else         if (isWithdrawal == true) {
          transType="String_Node_Str";
          mCommon.transactionEntity.setTransactionType(TransactionTypes.Withdrawal);
        }
        mCommon.transactionEntity.setStatus("String_Node_Str");
        if (transType != "String_Node_Str" && msgBody.toLowerCase().contains("String_Node_Str") == false) {
          Intent t_intent=new Intent(mContext,CheckingTransactionEditActivity.class);
          MmxHelper=new MmxOpenHelper(mContext,app_settings.getDatabaseSettings().getDatabasePath());
          db=MmxHelper.getReadableDatabase();
          baseCurencyID=gen_settings.getBaseCurrencytId();
          baseAccountID=gen_settings.getDefaultAccountId();
          baseAccountName="String_Node_Str";
          fromAccountID=-1;
          fromCurrencyID=-1;
          fromAccountName="String_Node_Str";
          if (baseAccountID > 0) {
            fromAccountID=baseAccountID;
            fromAccountName=baseAccountName;
            fromCurrencyID=baseCurencyID;
          }
          baseCurrencySymbl=getCurrencySymbl(baseCurencyID);
          fromAccCurrencySymbl=baseCurrencySymbl;
          String[] fromAccountDetails=extractAccountDetails(msgBody,1);
          if (!fromAccountDetails[0].isEmpty()) {
            fromAccountID=parseInt(fromAccountDetails[0]);
            fromAccountName=fromAccountDetails[1];
            fromCurrencyID=parseInt(fromAccountDetails[2]);
            fromAccCurrencySymbl=fromAccountDetails[3];
            mCommon.transactionEntity.setAccountId(fromAccountID);
          }
          mCommon.transactionEntity.setNotes(msgBody);
          mCommon.transactionEntity.setDate(new MmxDate().toDate());
          String transAmount=extractTransAmount(msgBody,fromAccCurrencySymbl);
          if (!transAmount.isEmpty()) {
            mCommon.transactionEntity.setAmount(MoneyFactory.fromString(transAmount));
            String[] transPayee=extractTransPayee(msgBody);
            String transRefNo=extractTransRefNo(msgBody);
            int txnId=getTxnId(transRefNo.trim(),transType,mCommon.transactionEntity.getDateString());
switch (txnId) {
case 0:
              if (transType == "String_Node_Str") {
                String[] toAccountDetails=extractAccountDetails(msgBody,2);
                if (!toAccountDetails[0].isEmpty()) {
                  toAccountID=parseInt(toAccountDetails[0]);
                  toAccountName=toAccountDetails[1];
                  toCurrencyID=parseInt(toAccountDetails[2]);
                  toAccCurrencySymbl=toAccountDetails[3];
                  mCommon.transactionEntity.setAccountToId(toAccountID);
                  CurrencyService currencyService=new CurrencyService(mContext);
                  mCommon.transactionEntity.setAmountTo(currencyService.doCurrencyExchange(fromCurrencyID,mCommon.transactionEntity.getAmount(),toCurrencyID));
                  mCommon.transactionEntity.setPayeeId(Constants.NOT_SET);
                }
 else {
                  transType="String_Node_Str";
                  mCommon.transactionEntity.setTransactionType(TransactionTypes.Withdrawal);
                  mCommon.transactionEntity.setAccountToId(Constants.NOT_SET);
                  mCommon.transactionEntity.setAmountTo(MoneyFactory.fromString(transAmount));
                  if (!toAccountDetails[6].isEmpty() && transPayee[0].isEmpty()) {
                    transPayee=getPayeeDetails(toAccountDetails[6].trim());
                  }
                }
              }
 else {
                mCommon.transactionEntity.setAccountToId(Constants.NOT_SET);
                mCommon.transactionEntity.setAmountTo(MoneyFactory.fromString(transAmount));
              }
            if (!transPayee[0].isEmpty()) {
              mCommon.transactionEntity.setPayeeId(parseInt(transPayee[0]));
              mCommon.payeeName=transPayee[1];
              mCommon.transactionEntity.setCategoryId(parseInt(transPayee[2]));
              mCommon.transactionEntity.setSubcategoryId(parseInt(transPayee[3]));
            }
 else {
              mCommon.payeeName="String_Node_Str";
            }
          t_intent.setAction(Intent.ACTION_INSERT);
        break;
default :
      transType="String_Node_Str";
    AccountTransactionRepository repo=new AccountTransactionRepository(mContext);
  AccountTransaction txn=repo.load(txnId);
if (txn != null) {
  if (txn.getTransactionType() != TransactionTypes.Transfer) {
    AccountRepository accountRepository=new AccountRepository(mContext);
    toAccountID=fromAccountID;
    toCurrencyID=fromCurrencyID;
    fromCurrencyID=accountRepository.loadCurrencyIdFor(txn.getAccountId());
    mCommon.transactionEntity=txn;
    mCommon.transactionEntity.setTransactionType(TransactionTypes.Transfer);
    mCommon.transactionEntity.setAccountToId(toAccountID);
    CurrencyService currencyService=new CurrencyService(mContext);
    mCommon.transactionEntity.setAmountTo(currencyService.doCurrencyExchange(fromCurrencyID,mCommon.transactionEntity.getAmount(),toCurrencyID));
    mCommon.transactionEntity.setPayeeId(Constants.NOT_SET);
    String[] transCategory=getCategoryOrSubCategoryByName("String_Node_Str");
    if (!transCategory[0].isEmpty()) {
      mCommon.transactionEntity.setCategoryId(parseInt(transCategory[0]));
      mCommon.transactionEntity.setSubcategoryId(parseInt(transCategory[1]));
    }
    mCommon.transactionEntity.setNotes(mCommon.transactionEntity.getNotes() + "String_Node_Str" + msgBody);
  }
}
t_intent.setAction(Intent.ACTION_EDIT);
}
String strExtracted="String_Node_Str" + fromAccountName + "String_Node_Str"+ fromAccountDetails[6]+ "String_Node_Str"+ "String_Node_Str"+ fromAccCurrencySymbl+ "String_Node_Str"+ transAmount+ "String_Node_Str"+ "String_Node_Str"+ transPayee[1]+ "String_Node_Str"+ "String_Node_Str"+ transPayee[2]+ "String_Node_Str"+ "String_Node_Str"+ transPayee[3]+ "String_Node_Str"+ "String_Node_Str"+ transRefNo+ "String_Node_Str"+ "String_Node_Str"+ transType+ "String_Node_Str";
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_ID,mCommon.transactionEntity.getId());
t_intent.putExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID,String.valueOf(mCommon.transactionEntity.getAccountId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_TO_ACCOUNT_ID,String.valueOf(mCommon.transactionEntity.getAccountToId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_CODE,mCommon.getTransactionType());
t_intent.putExtra(EditTransactionActivityConstants.KEY_PAYEE_ID,String.valueOf(mCommon.transactionEntity.getPayeeId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_PAYEE_NAME,mCommon.payeeName);
t_intent.putExtra(EditTransactionActivityConstants.KEY_CATEGORY_ID,String.valueOf(mCommon.transactionEntity.getCategoryId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_SUBCATEGORY_ID,String.valueOf(mCommon.transactionEntity.getSubcategoryId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_AMOUNT,String.valueOf(mCommon.transactionEntity.getAmount()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_NOTES,mCommon.transactionEntity.getNotes());
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_DATE,new MmxDate().toDate());
if (validateData()) {
if (saveTransaction()) {
Toast.makeText(context,"String_Node_Str" + strExtracted,Toast.LENGTH_LONG).show();
}
 else {
startActivity(mContext,t_intent,null);
}
}
 else {
startActivity(mContext,t_intent,null);
}
bundle=null;
msgs=null;
msgBody="String_Node_Str";
msgSender="String_Node_Str";
mCommon=null;
}
}
}
}
}
 catch (Exception e) {
Toast.makeText(context,"String_Node_Str" + e,Toast.LENGTH_LONG).show();
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  mContext=context.getApplicationContext();
  final BehaviourSettings behav_settings=new BehaviourSettings(mContext);
  final GeneralSettings gen_settings=new GeneralSettings(mContext);
  final AppSettings app_settings=new AppSettings(mContext);
  final PreferenceConstants prf_const=new PreferenceConstants();
  int baseCurencyID, fromCurrencyID, toCurrencyID;
  int baseAccountID, fromAccountID, toAccountID;
  String baseCurrencySymbl, fromAccCurrencySymbl, toAccCurrencySymbl;
  String baseAccountName, fromAccountName, toAccountName;
  try {
    if (behav_settings.getBankSmsTrans() == true) {
      Bundle bundle=intent.getExtras();
      SmsMessage[] msgs=null;
      String msgBody="String_Node_Str";
      String msgSender="String_Node_Str";
      if (bundle != null) {
        Object[] pdus=(Object[])bundle.get("String_Node_Str");
        msgs=new SmsMessage[pdus.length];
        for (int i=0; i < msgs.length; i++) {
          msgs[i]=SmsMessage.createFromPdu((byte[])pdus[i]);
          msgSender=msgs[i].getOriginatingAddress();
          msgBody+=msgs[i].getMessageBody().toString();
        }
        ITransactionEntity model=AccountTransaction.create();
        mCommon=new EditTransactionCommonFunctions(null,model,database);
        String[] key_credit_search={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
        String[] key_debit_search={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
        String transType="String_Node_Str";
        Boolean isDeposit=validateTransType(key_credit_search,msgBody.toLowerCase());
        Boolean isWithdrawal=validateTransType(key_debit_search,msgBody.toLowerCase());
        if (isDeposit == true) {
          if (isWithdrawal == true) {
            transType="String_Node_Str";
            String[] transCategory=getCategoryOrSubCategoryByName("String_Node_Str");
            if (!transCategory[0].isEmpty()) {
              mCommon.transactionEntity.setCategoryId(parseInt(transCategory[0]));
            }
            if (!transCategory[1].isEmpty()) {
              mCommon.transactionEntity.setSubcategoryId(parseInt(transCategory[1]));
            }
            mCommon.transactionEntity.setTransactionType(TransactionTypes.Transfer);
          }
 else {
            transType="String_Node_Str";
            String[] incomeCategory=getCategoryOrSubCategoryByName("String_Node_Str");
            if (!incomeCategory[0].isEmpty()) {
              mCommon.transactionEntity.setCategoryId(parseInt(incomeCategory[0]));
            }
            if (!incomeCategory[1].isEmpty()) {
              mCommon.transactionEntity.setSubcategoryId(parseInt(incomeCategory[1]));
            }
            mCommon.transactionEntity.setTransactionType(TransactionTypes.Deposit);
          }
          mCommon.payeeName="String_Node_Str";
        }
 else         if (isWithdrawal == true) {
          transType="String_Node_Str";
          mCommon.transactionEntity.setTransactionType(TransactionTypes.Withdrawal);
        }
        mCommon.transactionEntity.setStatus("String_Node_Str");
        if (transType != "String_Node_Str" && msgBody.toLowerCase().contains("String_Node_Str") == false) {
          Intent t_intent=new Intent(mContext,CheckingTransactionEditActivity.class);
          MmxHelper=new MmxOpenHelper(mContext,app_settings.getDatabaseSettings().getDatabasePath());
          db=MmxHelper.getReadableDatabase();
          baseCurencyID=gen_settings.getBaseCurrencytId();
          baseAccountID=gen_settings.getDefaultAccountId();
          baseAccountName="String_Node_Str";
          fromAccountID=-1;
          fromCurrencyID=-1;
          fromAccountName="String_Node_Str";
          if (baseAccountID > 0) {
            fromAccountID=baseAccountID;
            fromAccountName=baseAccountName;
            fromCurrencyID=baseCurencyID;
          }
          baseCurrencySymbl=getCurrencySymbl(baseCurencyID);
          fromAccCurrencySymbl=baseCurrencySymbl;
          String[] fromAccountDetails=extractAccountDetails(msgBody,1);
          if (!fromAccountDetails[0].isEmpty()) {
            fromAccountID=parseInt(fromAccountDetails[0]);
            fromAccountName=fromAccountDetails[1];
            fromCurrencyID=parseInt(fromAccountDetails[2]);
            fromAccCurrencySymbl=fromAccountDetails[3];
            mCommon.transactionEntity.setAccountId(fromAccountID);
          }
          mCommon.transactionEntity.setNotes(msgBody);
          mCommon.transactionEntity.setDate(new MmxDate().toDate());
          String transAmount=extractTransAmount(msgBody,fromAccCurrencySymbl);
          if (!fromAccountDetails[6].isEmpty() && !transAmount.isEmpty()) {
            mCommon.transactionEntity.setAmount(MoneyFactory.fromString(transAmount));
            String[] transPayee=extractTransPayee(msgBody);
            String transRefNo=extractTransRefNo(msgBody);
            int txnId=getTxnId(transRefNo.trim(),transType,mCommon.transactionEntity.getDateString());
switch (txnId) {
case 0:
              if (transType == "String_Node_Str") {
                String[] toAccountDetails=extractAccountDetails(msgBody,2);
                if (!toAccountDetails[0].isEmpty()) {
                  toAccountID=parseInt(toAccountDetails[0]);
                  toAccountName=toAccountDetails[1];
                  toCurrencyID=parseInt(toAccountDetails[2]);
                  toAccCurrencySymbl=toAccountDetails[3];
                  mCommon.transactionEntity.setAccountToId(toAccountID);
                  CurrencyService currencyService=new CurrencyService(mContext);
                  mCommon.transactionEntity.setAmountTo(currencyService.doCurrencyExchange(fromCurrencyID,mCommon.transactionEntity.getAmount(),toCurrencyID));
                  mCommon.transactionEntity.setPayeeId(Constants.NOT_SET);
                }
 else {
                  transType="String_Node_Str";
                  mCommon.transactionEntity.setTransactionType(TransactionTypes.Withdrawal);
                  mCommon.transactionEntity.setAccountToId(Constants.NOT_SET);
                  mCommon.transactionEntity.setAmountTo(MoneyFactory.fromString(transAmount));
                  if (!toAccountDetails[6].isEmpty() && transPayee[0].isEmpty()) {
                    transPayee=getPayeeDetails(toAccountDetails[6].trim());
                  }
                }
              }
 else {
                mCommon.transactionEntity.setAccountToId(Constants.NOT_SET);
                mCommon.transactionEntity.setAmountTo(MoneyFactory.fromString(transAmount));
              }
            if (!transPayee[0].isEmpty()) {
              mCommon.transactionEntity.setPayeeId(parseInt(transPayee[0]));
              mCommon.payeeName=transPayee[1];
              mCommon.transactionEntity.setCategoryId(parseInt(transPayee[2]));
              mCommon.transactionEntity.setSubcategoryId(parseInt(transPayee[3]));
            }
 else {
              mCommon.payeeName="String_Node_Str";
            }
          t_intent.setAction(Intent.ACTION_INSERT);
        break;
default :
      transType="String_Node_Str";
    AccountTransactionRepository repo=new AccountTransactionRepository(mContext);
  AccountTransaction txn=repo.load(txnId);
if (txn != null) {
  if (txn.getTransactionType() != TransactionTypes.Transfer) {
    AccountRepository accountRepository=new AccountRepository(mContext);
    toAccountID=fromAccountID;
    toCurrencyID=fromCurrencyID;
    fromCurrencyID=accountRepository.loadCurrencyIdFor(txn.getAccountId());
    mCommon.transactionEntity=txn;
    mCommon.transactionEntity.setTransactionType(TransactionTypes.Transfer);
    mCommon.transactionEntity.setAccountToId(toAccountID);
    CurrencyService currencyService=new CurrencyService(mContext);
    mCommon.transactionEntity.setAmountTo(currencyService.doCurrencyExchange(fromCurrencyID,mCommon.transactionEntity.getAmount(),toCurrencyID));
    mCommon.transactionEntity.setPayeeId(Constants.NOT_SET);
    String[] transCategory=getCategoryOrSubCategoryByName("String_Node_Str");
    if (!transCategory[0].isEmpty()) {
      mCommon.transactionEntity.setCategoryId(parseInt(transCategory[0]));
      mCommon.transactionEntity.setSubcategoryId(parseInt(transCategory[1]));
    }
    mCommon.transactionEntity.setNotes(mCommon.transactionEntity.getNotes() + "String_Node_Str" + msgBody);
  }
}
t_intent.setAction(Intent.ACTION_EDIT);
}
String strExtracted="String_Node_Str" + fromAccountName + "String_Node_Str"+ fromAccountDetails[6]+ "String_Node_Str"+ "String_Node_Str"+ fromAccCurrencySymbl+ "String_Node_Str"+ transAmount+ "String_Node_Str"+ "String_Node_Str"+ transPayee[1]+ "String_Node_Str"+ "String_Node_Str"+ transPayee[2]+ "String_Node_Str"+ "String_Node_Str"+ transPayee[3]+ "String_Node_Str"+ "String_Node_Str"+ transRefNo+ "String_Node_Str"+ "String_Node_Str"+ transType+ "String_Node_Str";
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_SOURCE,"String_Node_Str");
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_ID,mCommon.transactionEntity.getId());
t_intent.putExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID,String.valueOf(mCommon.transactionEntity.getAccountId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_TO_ACCOUNT_ID,String.valueOf(mCommon.transactionEntity.getAccountToId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_CODE,mCommon.getTransactionType());
t_intent.putExtra(EditTransactionActivityConstants.KEY_PAYEE_ID,String.valueOf(mCommon.transactionEntity.getPayeeId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_PAYEE_NAME,mCommon.payeeName);
t_intent.putExtra(EditTransactionActivityConstants.KEY_CATEGORY_ID,String.valueOf(mCommon.transactionEntity.getCategoryId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_SUBCATEGORY_ID,String.valueOf(mCommon.transactionEntity.getSubcategoryId()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_AMOUNT,String.valueOf(mCommon.transactionEntity.getAmount()));
t_intent.putExtra(EditTransactionActivityConstants.KEY_NOTES,mCommon.transactionEntity.getNotes());
t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_DATE,new MmxDate().toDate());
if (validateData()) {
if (saveTransaction()) {
Toast.makeText(context,"String_Node_Str" + strExtracted,Toast.LENGTH_LONG).show();
}
 else {
startActivity(mContext,t_intent,null);
}
}
 else {
startActivity(mContext,t_intent,null);
}
bundle=null;
msgs=null;
msgBody="String_Node_Str";
msgSender="String_Node_Str";
mCommon=null;
}
}
}
}
}
 catch (Exception e) {
Toast.makeText(context,"String_Node_Str" + e,Toast.LENGTH_LONG).show();
}
}