Buggy code:
public class ReportDao { private Connection dbConnection ; private PreparedStatement pStmt ; private Statement stmt ; private String queryBase = "SELECT<seq2seq4repair_space>cod_fiscale<seq2seq4repair_space>AS<seq2seq4repair_space>'Codice<seq2seq4repair_space>Fiscale'," + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "nome<seq2seq4repair_space>AS<seq2seq4repair_space>'Nome'," + "cognome<seq2seq4repair_space>AS<seq2seq4repair_space>'Cognome'," ) + "sesso<seq2seq4repair_space>AS<seq2seq4repair_space>'Genere',<seq2seq4repair_space>" ) + "S.descrizione<seq2seq4repair_space>AS<seq2seq4repair_space>'Stato<seq2seq4repair_space>Civile'," ) + "luogo_nascita<seq2seq4repair_space>AS<seq2seq4repair_space>'Luogo<seq2seq4repair_space>di<seq2seq4repair_space>Nascita'," ) + "DATE_FORMAT(data_nascita,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Data<seq2seq4repair_space>di<seq2seq4repair_space>Nascita',<seq2seq4repair_space>" ) + "N.DENOMINAZIONE<seq2seq4repair_space>AS<seq2seq4repair_space>'Nazione',<seq2seq4repair_space>" ) + "indirizzo_residenza<seq2seq4repair_space>AS<seq2seq4repair_space>'Indirizzo<seq2seq4repair_space>di<seq2seq4repair_space>Residenza'," ) + "citta_residenza<seq2seq4repair_space>AS<seq2seq4repair_space>'Città<seq2seq4repair_space>di<seq2seq4repair_space>Residenza'," ) + "cap<seq2seq4repair_space>AS<seq2seq4repair_space>'CAP'," ) + "P.sigla_autom<seq2seq4repair_space>AS<seq2seq4repair_space>'Provincia'," ) + "permesso_soggiorno<seq2seq4repair_space>AS<seq2seq4repair_space>'Perm.<seq2seq4repair_space>Sogg.'," ) + "telefono<seq2seq4repair_space>AS<seq2seq4repair_space>'Recapito<seq2seq4repair_space>Telefonico',<seq2seq4repair_space>" ) + "email<seq2seq4repair_space>AS<seq2seq4repair_space>'Indirizzo<seq2seq4repair_space>email'," ) + "num_documento<seq2seq4repair_space>AS<seq2seq4repair_space>'Documento<seq2seq4repair_space>Identità',<seq2seq4repair_space>" ) + "E.descrizione<seq2seq4repair_space>AS<seq2seq4repair_space>'Ente<seq2seq4repair_space>Assistente'," ) + "PE.DENOMINAZIONE<seq2seq4repair_space>AS<seq2seq4repair_space>'Provincia<seq2seq4repair_space>Ente'," ) + "DATE_FORMAT(data_inserimento,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Inizio<seq2seq4repair_space>Assistenza'," ) + "DATE_FORMAT(data_fine_assistenza,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Fine<seq2seq4repair_space>Assistenza'," ) + "punteggio_idb<seq2seq4repair_space>AS<seq2seq4repair_space>'Indice<seq2seq4repair_space>di<seq2seq4repair_space>Bisogno'," ) + "EN.descrizione<seq2seq4repair_space>as<seq2seq4repair_space>'Emporio'," ) + "DATE_FORMAT(data_candidatura,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Candidatura'," ) + "DATE_FORMAT(data_accettazione,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Accettazione',<seq2seq4repair_space>" ) + "DATE_FORMAT(data_scadenza,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Scadenza'," ) + "DATE_FORMAT(data_dismissione,'%d//%m//%Y')<seq2seq4repair_space>AS<seq2seq4repair_space>'Dimissione'<seq2seq4repair_space>" ) + "FROM<seq2seq4repair_space>ASSISTITI<seq2seq4repair_space>A<seq2seq4repair_space>" ) + "LEFT<seq2seq4repair_space>JOIN<seq2seq4repair_space>ENTI<seq2seq4repair_space>E<seq2seq4repair_space>ON<seq2seq4repair_space>A.ENTE_ASSISTENTE=E.ID<seq2seq4repair_space>" ) + "LEFT<seq2seq4repair_space>JOIN<seq2seq4repair_space>ENTI<seq2seq4repair_space>EN<seq2seq4repair_space>ON<seq2seq4repair_space>A.EMPORIO=EN.ID<seq2seq4repair_space>" ) + "LEFT<seq2seq4repair_space>JOIN<seq2seq4repair_space>PROVINCE<seq2seq4repair_space>P<seq2seq4repair_space>ON<seq2seq4repair_space>A.PROVINCIA=P.COD_PROVINCIA<seq2seq4repair_space>" ) + "LEFT<seq2seq4repair_space>JOIN<seq2seq4repair_space>PROVINCE<seq2seq4repair_space>PE<seq2seq4repair_space>ON<seq2seq4repair_space>E.PROVINCIA_ENTE=PE.COD_PROVINCIA<seq2seq4repair_space>" ) + "LEFT<seq2seq4repair_space>JOIN<seq2seq4repair_space>NAZIONI<seq2seq4repair_space>N<seq2seq4repair_space>ON<seq2seq4repair_space>A.NAZIONALITA=N.CODICE<seq2seq4repair_space>" ) + "LEFT<seq2seq4repair_space>JOIN<seq2seq4repair_space>STATI_CIVILI<seq2seq4repair_space>S<seq2seq4repair_space>ON<seq2seq4repair_space>A.STATO_CIVILE=S.ID<seq2seq4repair_space>" ) ; private String orderBy = "<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>PE.DENOMINAZIONE,<seq2seq4repair_space>E.DESCRIZIONE,<seq2seq4repair_space>A.COD_FISCALE" ; public ReportDao ( ) { } public ResultSet anagraficaCompleta ( ) { } public ResultSet anagraficaXEnteUser ( User user ) { } public ResultSet anagraficaXProvinciaEnteUser ( User user ) { } public ResultSet graduatoriaProvinciale ( User user ) { ResultSet rs = null ; <START_BUG> String query = ( ( ( ( queryBase ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>E.PROVINCIA_ENTE=<seq2seq4repair_space>" ) + ( user . getProvinciaEnte ( ) ) ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>PUNTEGGIO_IDB<seq2seq4repair_space>><seq2seq4repair_space>0<seq2seq4repair_space>AND<seq2seq4repair_space>DATA_CANDIDATURA<seq2seq4repair_space>IS<seq2seq4repair_space>NULL<seq2seq4repair_space>AND<seq2seq4repair_space>DATA_ACCETTAZIONE<seq2seq4repair_space>IS<seq2seq4repair_space>NULL" ) + "<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>PUNTEGGIO_IDB<seq2seq4repair_space>DESC,<seq2seq4repair_space>DATA_CANDIDATURA<seq2seq4repair_space>ASC" ; <END_BUG> try { pStmt = dbConnection . prepareStatement ( query ) ; rs = pStmt . executeQuery ( ) ; } catch ( SQLException e ) { System . err . println ( e . getMessage ( ) ) ; } return rs ; } public ResultSet ritiri ( ) { } public ResultSet eccedenze ( ) { } public ResultSet tabellaAssistiti ( int ente ) { } public ResultSet tabellaNucleoFamiliare ( int ente ) { } public ResultSet tabellaIndiciBisogno ( int ente ) { } public ResultSet tabellaNoteAssistiti ( int ente ) { } public ResultSet tabellaEccedenze ( int ente ) { } public ResultSet tabellaImpegni ( int ente ) { } public ResultSet tabellaUsers ( int ente ) { } public ResultSet tabellaGroups ( ) { } public ResultSet tabellaEnti ( ) { } public ResultSet tabellaMessages ( ) { } public ResultSet tabellaStatiCivili ( ) { } public ResultSet tabellaGradiParentela ( ) { } public ResultSet tabellaNazioni ( ) { } public ResultSet tabellaProvince ( ) { } public ResultSet tabellaUniMisura ( ) { } No newline ; at end ; of file ; }

Fix:
String query = ( ( ( ( queryBase ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>E.PROVINCIA_ENTE=<seq2seq4repair_space>" ) + ( user . getProvinciaEnte ( ) ) ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>PUNTEGGIO_IDB<seq2seq4repair_space>><seq2seq4repair_space>0<seq2seq4repair_space>AND<seq2seq4repair_space>DATA_CANDIDATURA<seq2seq4repair_space>IS<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL<seq2seq4repair_space>AND<seq2seq4repair_space>DATA_ACCETTAZIONE<seq2seq4repair_space>IS<seq2seq4repair_space>NULL" ) + "<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>PUNTEGGIO_IDB<seq2seq4repair_space>DESC,<seq2seq4repair_space>DATA_CANDIDATURA<seq2seq4repair_space>ASC" ;