Buggy code:
int revNumber = 1 ; String [ ] tokens = requestParser . getRequest ( ) . getNumber ( ) . split ( "R" ) ; if ( ( tokens . length ) > 1 ) { if ( ( ( tokens [ 1 ] ) != null ) && ( ! ( tokens [ 1 ] . equals ( "" ) ) ) ) { Integer oldRevNumber = Integer . valueOf ( tokens [ 1 ] ) ; revNumber = ( oldRevNumber . intValue ( ) ) + 1 ; } originalRequestNumber = ( tokens [ 0 ] ) + "R" ; } requestParser . getRequest ( ) . setNumber ( ( ( originalRequestNumber ) + revNumber ) ) ; sess . flush ( ) ; } boolean createBillingItems = false ; if ( ! ( requestParser . isExternalExperiment ( ) ) ) { if ( ( requestParser . isNewRequest ( ) ) && ( ! ( pdh . getCoreFacilityRequestCategoryProperty ( requestParser . getRequest ( ) . getIdCoreFacility ( ) , requestParser . getRequest ( ) . getCodeRequestCategory ( ) , NEW_REQUEST_SAVE_BEFORE_SUBMIT ) . equals ( "Y" ) ) ) ) { String prop = propertyHelper . getCoreFacilityRequestCategoryProperty ( requestCategory . getIdCoreFacility ( ) , requestCategory . getCodeRequestCategory ( ) , BILLING_DURING_WORKFLOW ) ; if ( ( prop == null ) || ( ! ( prop . equals ( "Y" ) ) ) ) { createBillingItems = true ; } } else if ( ( ( ! ( requestParser . isNewRequest ( ) ) ) && ( ! ( requestParser . getRequest ( ) . getCodeRequestCategory ( ) . equals ( FRAGMENT_ANALYSIS_REQUEST_CATEGORY ) ) ) ) && ( ! ( requestParser . getRequest ( ) . getCodeRequestCategory ( ) . equals ( MITOCHONDRIAL_DLOOP_SEQ_REQUEST_CATEGORY ) ) ) ) { if ( RequestCategory . isDNASeqCoreRequestCategory ( requestParser . getRequest ( ) . getCodeRequestCategory ( ) ) ) { if ( ( ( requestParser . getRequest ( ) . getBillingItemList ( sess ) ) != null ) && ( ! ( requestParser . getRequest ( ) . getBillingItemList ( sess ) . isEmpty ( ) ) ) ) { if ( hasNewSample ) { billingAccountMessage += ( ( billingAccountMessage . length ( ) ) > 0 ) ? "<seq2seq4repair_space>" : ( ( "" + "Request<seq2seq4repair_space>" ) + ( requestParser . getRequest ( ) . getNumber ( ) ) ) + "<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>saved.\n\nSamples<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>added,<seq2seq4repair_space>please<seq2seq4repair_space>adjust<seq2seq4repair_space>billing<seq2seq4repair_space>accordingly." ; } } } } } if ( createBillingItems || ( requestParser . isReassignBillingAccount ( ) ) ) { sess . refresh ( requestParser . getRequest ( ) ) ; if ( requestParser . getAmendState ( ) . equals ( AMEND_QC_TO_SEQ ) ) { samplesAdded . addAll ( requestParser . getRequest ( ) . getSamples ( ) ) ; } SaveRequest . createBillingItems ( sess , requestParser . getRequest ( ) , requestParser . getAmendState ( ) , billingPeriod , dictionaryHelper , samplesAdded , labeledSamplesAdded , hybsAdded , sequenceLanesAdded , requestParser . getSampleAssays ( ) , null , PENDING , propertyEntries , billingTemplate , false , false ) ; sess . flush ( ) ; } else <START_BUG> if ( createBillingItems && ( ! ( pdh . getCoreFacilityRequestCategoryProperty ( requestParser . getRequest ( ) . getIdCoreFacility ( ) , requestParser . getRequest ( ) . getCodeRequestCategory ( ) , NEW_REQUEST_SAVE_BEFORE_SUBMIT ) . equals ( "Y" ) ) ) ) { <END_BUG> SaveRequest . createBillingItems ( sess , requestParser . getRequest ( ) , requestParser . getAmendState ( ) , billingPeriod , dictionaryHelper , samplesAdded , labeledSamplesAdded , hybsAdded , sequenceLanesAdded , requestParser . getSampleAssays ( ) , null , PENDING , propertyEntries , billingTemplate , true , false ) ; } reassignLabForTransferLog ( sess ) ; sess . flush ( ) ; if ( ( ! ( requestParser . isExternalExperiment ( ) ) ) && ( RequestCategory . isIlluminaRequestCategory ( requestParser . getRequest ( ) . getCodeRequestCategory ( ) ) ) ) { this . createResultDirectories ( requestParser . getRequest ( ) , "Sample<seq2seq4repair_space>QC" , PropertyDictionaryHelper . getInstance ( sess ) . getExperimentDirectory ( serverName , requestParser . getRequest ( ) . getIdCoreFacility ( ) ) ) ; this . createResultDirectories ( requestParser . getRequest ( ) , "Library<seq2seq4repair_space>QC" , PropertyDictionaryHelper . getInstance ( sess ) . getExperimentDirectory ( serverName , requestParser . getRequest ( ) . getIdCoreFacility ( ) ) ) ; } else if ( ( ! ( requestParser . isExternalExperiment ( ) ) ) && ( ( RequestCategory . isMicroarrayRequestCategory ( requestParser . getRequest ( ) . getCodeRequestCategory ( ) ) ) || ( requestParser . getRequest ( ) . getCodeRequestCategory ( ) . equals ( TYPE_QC ) ) ) ) { this . createResultDirectories ( requestParser . getRequest ( ) , "Sample<seq2seq4repair_space>QC" , PropertyDictionaryHelper . getInstance ( sess ) . getExperimentDirectory ( serverName , requestParser . getRequest ( ) . getIdCoreFacility ( ) ) ) ; } String emailErrorMessage = sendEmails ( sess ) ; this . xmlResult = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "<SUCCESS<seq2seq4repair_space>idRequest=\"" + ( requestParser . getRequest ( ) . getIdRequest ( ) ) ) + "\"<seq2seq4repair_space>requestNumber=\"" ) + ( requestParser . getRequest ( ) . getNumber ( ) ) ) + "\"<seq2seq4repair_space>deleteSampleCount=\"" ) + ( this . samplesDeleted . size ( ) ) ) + "\"<seq2seq4repair_space>deleteHybCount=\"" ) + ( this . hybsDeleted . size ( ) ) ) + "\"<seq2seq4repair_space>deleteLaneCount=\"" ) + ( this . sequenceLanesDeleted . size ( ) ) ) + "\"<seq2seq4repair_space>billingAccountMessage<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + billingAccountMessage ) + "\"<seq2seq4repair_space>emailErrorMessage<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + emailErrorMessage ) + "\"<seq2seq4repair_space>requestPropertyBillingMessage<seq2seq4repair_space>=<seq2seq4repair_space>\"" ) + requestPropertyBillingMessage ) + "\"//>" ; } } if ( isValid ( ) ) { setResponsePage ( this . SUCCESS_JSP ) ;

Fix:
if ( ( ! ( requestParser . isExternalExperiment ( ) ) ) && ( ! ( pdh . getCoreFacilityRequestCategoryProperty ( requestParser . getRequest ( ) . getIdCoreFacility ( ) , requestParser . getRequest ( ) . getCodeRequestCategory ( ) , NEW_REQUEST_SAVE_BEFORE_SUBMIT ) . equals ( "Y" ) ) ) ) {