Buggy code:
public class SellFundAction extends Action { private FormBeanFactory < SellFundForm > formBeanFactory = FormBeanFactory . getInstance ( SellFundForm . class ) ; private PositionDAO positionDAO ; private FundDAO fundDAO ; private TransactionDAO transactionDAO ; private CustomerDAO customerDAO ; private FundPriceHistoryDAO fundPriceHistoryDAO ; public SellFundAction ( Model model ) { } @ Override public String getName ( ) { } @ Override public String perform ( HttpServletRequest request ) { List < String > errors = new ArrayList < String > ( ) ; List < String > successes = new ArrayList < String > ( ) ; request . setAttribute ( "errors" , errors ) ; request . setAttribute ( "successes" , successes ) ; try { SellFundForm form = formBeanFactory . create ( request ) ; request . setAttribute ( "form" , form ) ; HttpSession session = request . getSession ( ) ; CustomerBean customer = ( ( CustomerBean ) ( session . getAttribute ( "customer" ) ) ) ; if ( customer == null ) { errors . add ( "session<seq2seq4repair_space>expired" ) ; return "index.do" ; } <START_BUG> CustomerBean latestCustomer = customerDAO . read ( customer ) ; <END_BUG> request . setAttribute ( "balance" , ConvertUtil . convertAmountLongToDouble ( latestCustomer . getBalance ( ) ) ) ; FundBean [ ] funds = fundDAO . getAllFunds ( ) ; ArrayList < PositionAndFundBean > positionAndFunds = new ArrayList < PositionAndFundBean > ( ) ; Date latestDay = fundPriceHistoryDAO . findLatestDate ( ) ; for ( int i = 0 ; i < ( funds . length ) ; i ++ ) { PositionBean position = positionDAO . read ( funds [ i ] . getFund_id ( ) , customer . getCustomer_id ( ) ) ; if ( position == null ) { continue ; } FundPriceHistoryBean price = fundPriceHistoryDAO . read ( funds [ i ] . getFund_id ( ) , latestDay ) ; PositionAndFundBean positionAndFund = new PositionAndFundBean ( ) ; positionAndFund . setAvailable_shares ( position . getAvailable_shares ( ) ) ; positionAndFund . setCustomer_id ( customer . getCustomer_id ( ) ) ; positionAndFund . setFund_id ( funds [ i ] . getFund_id ( ) ) ; positionAndFund . setName ( funds [ i ] . getName ( ) ) ; positionAndFund . setShares ( position . getShares ( ) ) ; positionAndFund . setSymbol ( funds [ i ] . getSymbol ( ) ) ; positionAndFund . setPrice ( price . getPrice ( ) ) ; positionAndFunds . add ( positionAndFund ) ; System . out . println ( ( "test<seq2seq4repair_space>" + ( positionAndFund . getAvailable_shares ( ) ) ) ) ; } request . setAttribute ( "positionAndFunds" , positionAndFunds . toArray ( new PositionAndFundBean [ positionAndFunds . size ( ) ] ) ) ; if ( ! ( form . isPresent ( ) ) ) { System . out . println ( "No<seq2seq4repair_space>param" ) ; return "sellFund.jsp" ; } errors . addAll ( form . getValidationErrors ( ) ) ; if ( ( errors . size ( ) ) != 0 ) { return "sellFund.jsp" ; } System . out . println ( ( "Fund<seq2seq4repair_space>name<seq2seq4repair_space>in<seq2seq4repair_space>form<seq2seq4repair_space>is<seq2seq4repair_space>" + ( form . getFundname ( ) ) ) ) ; FundBean fund = fundDAO . getFundByName ( form . getFundname ( ) ) ; positionDAO . updateAvailableShares ( fund . getFund_id ( ) , customer . getCustomer_id ( ) , form . getShareAsDouble ( ) ) ; TransactionBean transaction = new TransactionBean ( ) ; transaction . setCustomer_id ( customer . getCustomer_id ( ) ) ; transaction . setFund_id ( fund . getFund_id ( ) ) ; transaction . setIs_complete ( false ) ; transaction . setIs_success ( false ) ; transaction . setShares ( ConvertUtil . coverShareDoubleToLong ( form . getShareAsDouble ( ) ) ) ; transaction . setTransaction_date ( new Date ( ) ) ; transaction . setTrasaction_type ( "sell" ) ; transactionDAO . createAutoIncrement ( transaction ) ; successes . add ( "Your<seq2seq4repair_space>transaction<seq2seq4repair_space>is<seq2seq4repair_space>in<seq2seq4repair_space>process<seq2seq4repair_space>!" ) ; } catch ( FormBeanException e ) { errors . add ( e . getMessage ( ) ) ; return "sellFund.jsp" ; } catch ( RollbackException e ) { errors . add ( e . getMessage ( ) ) ; return "sellFund.jsp" ; } catch ( SharesOutOfBoundException e ) { errors . add ( e . getMessage ( ) ) ; return "sellFund.jsp" ; } return "manage.jsp" ; } }

Fix:
CustomerBean latestCustomer = customerDAO . read ( customer . getCustomer_id ( ) ) ;