Buggy code:
@ RequiresRoles ( "RECEIVE" ) @ RequestMapping ( value = "//add" , method = RequestMethod . POST ) public String addPost ( HttpServletRequest request , Prescription prs ) { } @ RequiresRoles ( value = { "ADMIN" , "RECEIVE" , "PACKAGE" , "SHIP" } , logical = Logical . OR ) @ RequestMapping ( value = "//modify" , method = RequestMethod . GET ) public String modify ( HttpServletRequest request ) { } @ RequiresRoles ( value = { "ADMIN" , "RECEIVE" , "PACKAGE" , "SHIP" } , logical = Logical . OR ) @ RequestMapping ( value = "//modify" , method = RequestMethod . POST ) public String modifyPost ( HttpServletRequest request , Prescription prs ) { } @ RequiresRoles ( "RECEIVE" ) @ RequestMapping ( "//delete" ) public String delete ( HttpServletRequest request ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( value = "//currentList" , method = RequestMethod . GET ) public String getCurrentList ( HttpServletRequest request , @ RequestParam ( name = "pageNum" , defaultValue = "1" ) int pageNum , @ RequestParam ( name = "hospitalId" , defaultValue = "0" ) int hospitalId , @ RequestParam ( name = "process" , defaultValue = "0" ) int process ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( value = "//historyList" , method = RequestMethod . GET ) public String getHistoryList ( HttpServletRequest request , @ RequestParam ( name = "pageNum" , defaultValue = "1" ) int pageNum , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( value = "//hospitalDimensionList" , method = RequestMethod . GET ) public String listHospitalDimension ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( value = "//orderDimensionList" , method = RequestMethod . GET ) public String listOrderDimension ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId , @ RequestParam ( name = "pageNum" , defaultValue = "1" ) int pageNum ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( value = "//userDimensionList" , method = RequestMethod . GET ) public String listUserDimension ( HttpServletRequest request , @ RequestParam ( value = "userAuth" , defaultValue = "0" ) int userAuth ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( value = "//dimensionPrsList" , method = RequestMethod . GET ) public String dimensionPrsList ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId , @ RequestParam ( name = "pageNum" , defaultValue = "1" ) int pageNum , @ RequestParam ( value = "from" , defaultValue = "HOSPITAL" ) String from ) { } @ RequiresRoles ( "ADMIN" ) @ RequestMapping ( "//printSingleLabel" ) public String printSingleLabelPackage ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId , @ RequestParam ( value = "process" , defaultValue = "0" ) int process , @ RequestParam ( value = "pageNum" , defaultValue = "1" ) int pageNum , @ RequestParam ( value = "printType" , defaultValue = "PACKAGE" ) String printType , @ RequestParam ( value = "from" , defaultValue = "CURRENT" ) String from , @ RequestParam ( value = "prsId" , defaultValue = "0" ) int prsId ) { } @ RequiresRoles ( "RECEIVE" ) @ RequestMapping ( "//printReceiveList" ) public String printReceiveList ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId ) { } @ RequiresRoles ( "PACKAGE" ) @ RequestMapping ( "//printPackageList" ) public String printPackageList ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId ) { } @ RequiresRoles ( "PACKAGE" ) @ RequestMapping ( "//printShipListXls" ) public String printShipListXls ( HttpServletRequest request , @ RequestParam ( value = "hospitalId" , defaultValue = "0" ) int hospitalId ) { List < Integer > usedHospitals = new ArrayList < Integer > ( ) ; if ( hospitalId == 0 ) { usedHospitals = prsService . listInProgressHospitalwithProcess ( SHIP ) ; } else { usedHospitals . add ( hospitalId ) ; } List < Prescription > prs = null ; int tempHospitalId ; int count = 0 ; Iterator < Integer > itr = usedHospitals . iterator ( ) ; User currentUser = ( ( User ) ( SecurityUtils . getSubject ( ) . getSession ( ) . getAttribute ( "user" ) ) ) ; while ( itr . hasNext ( ) ) { tempHospitalId = itr . next ( ) ; Hospital tempHospital = hospitalService . getHospitalById ( tempHospitalId ) ; <START_BUG> prs = prsService . listPrsWithProHospitalNoUser ( SHIP , tempHospitalId ) ; <END_BUG> if ( prsService . generatePrsListXls ( tempHospitalId , currentUser , prs ) ) { SimpleDateFormat df = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ; String currentTime = df . format ( new Date ( ) ) ; int randomNum = ( ( int ) ( ( Math . random ( ) ) * 900 ) ) + 100 ; String uuid = currentTime + ( String . valueOf ( randomNum ) ) ; Order newOrder = new Order ( ) ; newOrder . setUuid ( uuid ) ; newOrder . setHospital_id ( tempHospitalId ) ; newOrder . setCreate_time ( currentTime ) ; newOrder . setCreate_user_id ( currentUser . getId ( ) ) ; newOrder . setStatus ( ORDER_BEGIN ) ; if ( orderService . createFullOrder ( newOrder ) ) { newOrder . setId ( orderService . getOrderIdByUuid ( newOrder . getUuid ( ) ) ) ; Iterator < Prescription > prsItems = prs . iterator ( ) ; Prescription item = null ; while ( prsItems . hasNext ( ) ) { item = prsItems . next ( ) ;

Fix:
prs = prsService . listPrsWithProHospitalNoUser_Ship ( SHIP , tempHospitalId ) ;