Buggy code:
@ Controller public class OrderController { private DAOFactory daoFactory = DAOFactory . getFactory ( ) ; OrderDAO orderDao = daoFactory . getOrderDAO ( ) ; ProductDAO productDao = daoFactory . getProductDAO ( ) ; CartDAO cartDao = daoFactory . getCartDAO ( ) ; CustomerDAO custDao = daoFactory . getCustomerDAO ( ) ; TransactionHistoryDAO histDao = daoFactory . getTransactionHistoryDAO ( ) ; PaymentDAO payDao = daoFactory . getPaymentDAO ( ) ; @ RequestMapping ( value = "//order//{id}" , method = RequestMethod . POST ) public String createOrder ( @ PathVariable Long id , @ RequestParam ( "quantity" ) int qn , Model model , HttpServletRequest request ) { HttpSession session = request . getSession ( ) ; List < Cart > currentCart = ( ( List < Cart > ) ( session . getAttribute ( "userCart" ) ) ) ; System . out . println ( ( "values<seq2seq4repair_space>in<seq2seq4repair_space>existing<seq2seq4repair_space>cart<seq2seq4repair_space>............" + currentCart ) ) ; String result = "index" ; cartDao . beginTransaction ( ) ; Product fetchedProduct = ( ( Product ) ( productDao . findByPrimaryKey ( id ) ) ) ; if ( qn > ( fetchedProduct . getProductQuantity ( ) ) ) { String forQuantity = "We<seq2seq4repair_space>dont<seq2seq4repair_space>have<seq2seq4repair_space>sufficient,<seq2seq4repair_space>choose<seq2seq4repair_space>less<seq2seq4repair_space>than<seq2seq4repair_space>" + ( fetchedProduct . getProductQuantity ( ) ) ; model . addAttribute ( "lessQuantity" , forQuantity ) ; model . addAttribute ( "product" , fetchedProduct ) ; cartDao . commitTransaction ( ) ; result = "productDetails" ; } else { if ( currentCart == null ) { ArrayList < Cart > newCart = new ArrayList < Cart > ( ) ; System . out . println ( fetchedProduct . getProductName ( ) ) ; Cart cart = new Cart ( ) ; cart . setProduct ( fetchedProduct ) ; fetchedProduct . getCart ( ) . add ( cart ) ; cart . setQuantity ( qn ) ; newCart . add ( cart ) ; session . setAttribute ( "userCart" , newCart ) ; cartDao . commitTransaction ( ) ; System . out . println ( ( "Cart<seq2seq4repair_space>value<seq2seq4repair_space>================================" + ( newCart . size ( ) ) ) ) ; System . out . println ( fetchedProduct . getProductName ( ) ) ; } else { Cart cart = new Cart ( ) ; cart . setProduct ( fetchedProduct ) ; cart . setQuantity ( qn ) ; fetchedProduct . getCart ( ) . add ( cart ) ; currentCart . add ( cart ) ; session . setAttribute ( "userCart" , currentCart ) ; cartDao . commitTransaction ( ) ; System . out . println ( ( "Existing<seq2seq4repair_space>Cart<seq2seq4repair_space>value<seq2seq4repair_space>============================" + ( currentCart . size ( ) ) ) ) ; } } <START_BUG> return result ; <END_BUG> } @ RequestMapping ( value = "//cart" , method = RequestMethod . GET ) public String displayCart ( Model model , HttpServletRequest request ) { } @ RequestMapping ( value = "//payment" , method = RequestMethod . GET ) public String preparePayment ( Model model ) { } @ RequestMapping ( value = "//guestCheckout" , method = RequestMethod . GET ) public String prepareGuestCheckout ( Model model ) { } @ RequestMapping ( value = "//payment" , method = RequestMethod . POST ) public String makePayment ( HttpServletRequest request , @ RequestParam ( "cardNumber" ) String card , @ RequestParam ( "cvv" ) String cvv , @ RequestParam ( "expireDt" ) String ex_dt , Model model ) { } @ RequestMapping ( value = "//guestpayment" , method = RequestMethod . POST ) public String guestPayment ( HttpServletRequest request , @ RequestParam ( "cardNumber" ) String card , @ RequestParam ( "cvv" ) String cvv , @ RequestParam ( "expireDt" ) String ex_dt , @ RequestParam ( "firstName" ) String firstName , @ RequestParam ( "lastName" ) String lastName , @ RequestParam ( "phoneNumber" ) String phoneNumber , @ RequestParam ( "emailAddress" ) String emailAddress , @ RequestParam ( "state" ) String state , @ RequestParam ( "street" ) String street , @ RequestParam ( "city" ) String city , @ RequestParam ( "zip" ) String zip , @ RequestParam ( "country" ) String country , Model model ) { } @ RequestMapping ( value = "//order//cancel" , method = RequestMethod . GET ) public String cancelOrder ( HttpServletRequest request , Model model ) { } public List < Cart > updateProductQuantity ( List < Cart > cartList ) { } public String callRestfulness ( String uri ) { } }

Fix:
return "redirect://" ;