Buggy code:
@ Controller @ SessionAttributes ( "loggedInUser" ) public class OrderController { @ Autowired private OrderService orderService ; @ Autowired private UserService userService ; @ Autowired private TemplateService templateService ; @ Autowired private OrderPaginationService orderPaginationService ; private static final int NOT_COMPLETED_ORDERS = 0 ; private static final int IN_PROGRESS_ORDERS = 1 ; private static final int ALL_ORDERS = 2 ; private static final int COMPLETED_ORDERS = 3 ; @ RequestMapping ( value = "//orders" , method = { RequestMethod . GET , RequestMethod . POST } ) public String showAllOrders ( ModelMap model ) { } @ RequestMapping ( "//orders//all" ) @ ResponseBody public ResponseEntity < OrderWrapperHolder > showAll ( @ RequestParam Map < String , String > allRequestParams , ModelMap model ) { } @ RequestMapping ( "//orders//not-completed" ) @ ResponseBody public ResponseEntity < OrderWrapperHolder > showNotCompleted ( @ RequestParam Map < String , String > allRequestParams , ModelMap model ) { } @ RequestMapping ( value = "//orders//remove//{number}" , method = RequestMethod . POST ) @ ResponseBody public ResponseEntity < String > removeOrderByNumber ( @ PathVariable ( "number" ) long number , ModelMap model ) { } @ RequestMapping ( "//orders//completed" ) @ ResponseBody public ResponseEntity < OrderWrapperHolder > showCompleted ( @ RequestParam Map < String , String > allRequestParams , ModelMap model ) { } @ RequestMapping ( value = "//orders//{id}" , method = RequestMethod . GET ) public String showOrder ( @ PathVariable ( "id" ) long id , ModelMap model ) { } @ RequestMapping ( value = "//assignEmployee//{id}" , method = RequestMethod . POST ) public String assignEmployee ( @ PathVariable ( "id" ) long id , @ RequestParam ( "email" ) String email , ModelMap model ) { } @ RequestMapping ( value = "//assignTemplate//{id}" , method = RequestMethod . POST ) public String assignTemplate ( @ PathVariable ( "id" ) long id , @ RequestParam ( "name" ) String name , ModelMap model ) { } @ RequestMapping ( value = "//orders//download//{id}" , method = RequestMethod . GET ) public String downloadOrder ( @ PathVariable long id , HttpServletResponse response , ModelMap model ) { } private OrderWrapperHolder getOrderWrapperHolder ( Map < String , String > allRequestParams , int target ) { try { int start = Integer . parseInt ( allRequestParams . get ( "start" ) ) ; int length = Integer . parseInt ( allRequestParams . get ( "length" ) ) ; int column = Integer . parseInt ( allRequestParams . get ( "order[0][column]" ) ) ; String searchValue = allRequestParams . get ( "search[value]" ) ; String sortDir = allRequestParams . get ( "order[0][dir]" ) ; switch ( target ) { case OrderController . IN_PROGRESS_ORDERS : return orderPaginationService . getAllOrders ( ( start // length ) , length , searchValue , sortDir , column , OrderController . NOT_COMPLETED_ORDERS ) ; case OrderController . NOT_COMPLETED_ORDERS : return orderPaginationService . getAllOrders ( ( start // length ) , length , searchValue , sortDir , column , OrderController . NOT_COMPLETED_ORDERS ) ; case OrderController . ALL_ORDERS : <START_BUG> return orderPaginationService . getAllOrders ( ( start // length ) , length , searchValue , sortDir , column , OrderController . ALL_ORDERS ) ; <END_BUG> case OrderController . COMPLETED_ORDERS : return orderPaginationService . getAllOrders ( ( start // length ) , length , searchValue , sortDir , column , OrderController . COMPLETED_ORDERS ) ; default : return new OrderWrapperHolder ( ) ; } } catch ( Exception e ) { return new OrderWrapperHolder ( ) ; } } No newline ; at end ; of file ; }

Fix:
return orderPaginationService . getAllOrders ( ( start // length ) , length , searchValue , sortDir , column , OrderController . IN_PROGRESS_ORDERS ) ;