Buggy code:
@ Override public List getPaymentOutboundSummaryReport ( String fromDate , String toDate , String status , String invSupCode , String refNo , String username ) { Session session = this . sessionFactory . openSession ( ) ; UtilityFunction util = new UtilityFunction ( ) ; Date thisDate = new Date ( ) ; List data = new ArrayList ( ) ; String Query = ( ( ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>`payment_outbound_summary`<seq2seq4repair_space>where<seq2seq4repair_space>paydate<seq2seq4repair_space>BETWEEN<seq2seq4repair_space>'" + fromDate ) + "'<seq2seq4repair_space>and<seq2seq4repair_space>'" ) + toDate ) + "'<seq2seq4repair_space>" ; if ( ( status != null ) && ( ! ( "" . equalsIgnoreCase ( status ) ) ) ) { Query += ( "<seq2seq4repair_space>and<seq2seq4repair_space>status<seq2seq4repair_space>=<seq2seq4repair_space>'" + status ) + "'" ; } if ( ( invSupCode != null ) && ( ! ( "" . equalsIgnoreCase ( invSupCode ) ) ) ) { Query += ( "<seq2seq4repair_space>and<seq2seq4repair_space>suppliercode<seq2seq4repair_space>=<seq2seq4repair_space>'" + invSupCode ) + "'" ; } if ( ( refNo != null ) && ( ! ( "" . equalsIgnoreCase ( refNo ) ) ) ) { Query += ( "<seq2seq4repair_space>and<seq2seq4repair_space>refno<seq2seq4repair_space>=<seq2seq4repair_space>'" + refNo ) + "'" ; } Query += "<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>payno<seq2seq4repair_space>" ; System . out . println ( ( "Query<seq2seq4repair_space>:<seq2seq4repair_space>" + Query ) ) ; List < Object [ ] > QueryTicketList = session . createSQLQuery ( Query ) . addScalar ( "paymentid" , STRING ) . addScalar ( "payno" , STRING ) . addScalar ( "paydate" , STRING ) . addScalar ( "duepaymentdate" , STRING ) . addScalar ( "invoicesup" , STRING ) . addScalar ( "suppliercode" , STRING ) . addScalar ( "refno" , STRING ) . addScalar ( "leader" , STRING ) . addScalar ( "invoiceno" , STRING ) . addScalar ( "detail" , STRING ) . addScalar ( "amount" , STRING ) . addScalar ( "sale" , STRING ) . addScalar ( "export" , STRING ) . addScalar ( "status" , STRING ) . addScalar ( "diff" , STRING ) . addScalar ( "owner" , STRING ) . addScalar ( "amount_cur" , STRING ) . addScalar ( "sale_cur" , STRING ) . addScalar ( "value" , STRING ) . list ( ) ; SimpleDateFormat dateformat = new SimpleDateFormat ( ) ; dateformat . applyPattern ( "dd-MM-yyyy" ) ; for ( Object [ ] B : QueryTicketList ) { PaymentOutboundSummary sum = new PaymentOutboundSummary ( ) ; sum . setSystemdate ( util . ConvertString ( new SimpleDateFormat ( "dd<seq2seq4repair_space>MMM<seq2seq4repair_space>yyyy<seq2seq4repair_space>hh:mm:ss" , new Locale ( "us" , "us" ) ) . format ( thisDate ) ) ) ; sum . setUser ( username ) ; sum . setHeaderfromdate ( util . ConvertString ( new SimpleDateFormat ( "dd-MM-yyyy" , new Locale ( "us" , "us" ) ) . format ( util . convertStringToDate ( fromDate ) ) ) ) ; sum . setHeadertodate ( util . ConvertString ( new SimpleDateFormat ( "dd-MM-yyyy" , new Locale ( "us" , "us" ) ) . format ( util . convertStringToDate ( toDate ) ) ) ) ; sum . setHeaderstatus ( status ) ; sum . setHeaderrefno ( refNo ) ; sum . setHeaderinvoicesupcode ( invSupCode ) ; sum . setDatefromto ( ( ( ( sum . getHeaderfromdate ( ) ) + "<seq2seq4repair_space>to<seq2seq4repair_space>" ) + ( sum . getHeadertodate ( ) ) ) ) ; sum . setPaymentid ( util . ConvertString ( B [ 0 ] ) ) ; sum . setPayno ( util . ConvertString ( B [ 1 ] ) ) ; sum . setPaydate ( ( "null" . equals ( String . valueOf ( B [ 2 ] ) ) ? "" : util . ConvertString ( new SimpleDateFormat ( "dd//MM//yyyy" , new Locale ( "us" , "us" ) ) . format ( util . convertStringToDate ( util . ConvertString ( B [ 2 ] ) ) ) ) ) ) ; sum . setDuepaymentdate ( ( "null" . equals ( String . valueOf ( B [ 3 ] ) ) ? "" : util . ConvertString ( new SimpleDateFormat ( "dd//MM//yyyy" , new Locale ( "us" , "us" ) ) . format ( util . convertStringToDate ( util . ConvertString ( B [ 3 ] ) ) ) ) ) ) ; sum . setInvoicesup ( util . ConvertString ( B [ 4 ] ) ) ; sum . setSuppliercode ( util . ConvertString ( B [ 5 ] ) ) ; sum . setRefno ( util . ConvertString ( B [ 6 ] ) ) ; sum . setLeader ( util . ConvertString ( B [ 7 ] ) ) ; <START_BUG> sum . setInvoiceno ( util . ConvertString ( B [ 8 ] ) ) ; <END_BUG> sum . setDetail ( util . ConvertString ( B [ 9 ] ) ) ; sum . setAmount ( ( ! ( "null" . equalsIgnoreCase ( String . valueOf ( B [ 10 ] ) ) ) ? util . ConvertString ( B [ 10 ] ) : "0.00" ) ) ; sum . setSale ( ( ! ( "null" . equalsIgnoreCase ( String . valueOf ( B [ 11 ] ) ) ) ? util . ConvertString ( B [ 11 ] ) : "0.00" ) ) ; sum . setExport ( util . ConvertString ( B [ 12 ] ) ) ; sum . setStatus ( util . ConvertString ( B [ 13 ] ) ) ; sum . setDiff ( ( ! ( "null" . equalsIgnoreCase ( String . valueOf ( B [ 14 ] ) ) ) ? util . ConvertString ( B [ 14 ] ) : "" ) ) ; sum . setOwner ( util . ConvertString ( B [ 15 ] ) ) ; sum . setAmountcur ( util . ConvertString ( B [ 16 ] ) ) ; sum . setSalecur ( util . ConvertString ( B [ 17 ] ) ) ; sum . setValue ( util . ConvertString ( B [ 18 ] ) ) ; data . add ( sum ) ; } session . close ( ) ; this . sessionFactory . close ( ) ; return data ; }

Fix:
sum . setInvoiceno ( ( ( B [ 8 ] ) != null ? util . ConvertString ( B [ 8 ] ) . replaceAll ( "," , "\n" ) : "" ) ) ;