Buggy code:
select_sql ) ; ResultSet existingmunicipalityRS = selectqueryStmt . executeQuery ( ) ; Integer countHits = 0 ; StringBuffer moreThanOneRowContent = new StringBuffer ( ) ; while ( existingmunicipalityRS . next ( ) ) { countHits ++ ; countryid = existingmunicipalityRS . getInt ( "countryid" ) ; country = existingmunicipalityRS . getString ( "land" ) ; municipalityid = existingmunicipalityRS . getInt ( "municipalityid" ) ; municipality = existingmunicipalityRS . getString ( "stadt" ) ; jobid = existingmunicipalityRS . getInt ( "jobid" ) ; jobname = existingmunicipalityRS . getString ( "jobname" ) ; polygonAsText = existingmunicipalityRS . getString ( "polygon_astext" ) ; polygonSrid = existingmunicipalityRS . getInt ( "polygon_srid" ) ; moreThanOneRowContent . append ( ( ( ( ( ( ( ( ( ( country + "," ) + municipality ) + "," ) + ( existingmunicipalityRS . getString ( "officialkeys_id" ) ) ) + "," ) + ( existingmunicipalityRS . getInt ( "admin_level" ) ) ) + "," ) + jobname ) + "\n" ) ) ; } if ( countHits > 1 ) { System . out . println ( "Error:<seq2seq4repair_space>more<seq2seq4repair_space>than<seq2seq4repair_space>one<seq2seq4repair_space>related<seq2seq4repair_space>jobs<seq2seq4repair_space>were<seq2seq4repair_space>found,<seq2seq4repair_space>CANCEL<seq2seq4repair_space>import<seq2seq4repair_space>..." ) ; System . out . println ( moreThanOneRowContent . toString ( ) ) ; selectqueryStmt . close ( ) ; batchImport . con_hausnummern . close ( ) ; return false ; } else if ( countHits == 0 ) { selectqueryStmt . close ( ) ; System . out . println ( "Error:<seq2seq4repair_space>There<seq2seq4repair_space>is<seq2seq4repair_space>no<seq2seq4repair_space>matching<seq2seq4repair_space>municipality,<seq2seq4repair_space>the<seq2seq4repair_space>uploaded<seq2seq4repair_space>result<seq2seq4repair_space>will<seq2seq4repair_space>be<seq2seq4repair_space>suspended<seq2seq4repair_space>..." ) ; System . out . println ( ( ( ( ( ( ( ( ( "<seq2seq4repair_space>country<seq2seq4repair_space>===" + country ) + "===,<seq2seq4repair_space>municipality<seq2seq4repair_space>===" ) + municipality ) + "===,<seq2seq4repair_space>officialkeysId<seq2seq4repair_space>===" ) + officialkeysId ) + "===,<seq2seq4repair_space>jobname<seq2seq4repair_space>===" ) + jobname ) + "===" ) ) ; selectqueryStmt . close ( ) ; batchImport . con_hausnummern . close ( ) ; return false ; } System . out . println ( ( ( ( ( ( ( ( "related<seq2seq4repair_space>DB<seq2seq4repair_space>job:<seq2seq4repair_space>id<seq2seq4repair_space>#<seq2seq4repair_space>" + jobid ) + "<seq2seq4repair_space>jobname<seq2seq4repair_space>===" ) + jobname ) + "===<seq2seq4repair_space>in<seq2seq4repair_space>" ) + municipality ) + ",<seq2seq4repair_space>" ) + country ) ) ; String deletelastevaluationSql = "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>auswertung_hausnummern" + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>land_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND<seq2seq4repair_space>stadt_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND<seq2seq4repair_space>job_id<seq2seq4repair_space>=<seq2seq4repair_space>?;" ; PreparedStatement deletelastevaluationStmt = batchImport . con_hausnummern . prepareStatement ( deletelastevaluationSql ) ; System . out . println ( ( ( ( ( ( ( ( ( "Info:<seq2seq4repair_space>delete<seq2seq4repair_space>old<seq2seq4repair_space>evaluation<seq2seq4repair_space>in<seq2seq4repair_space>table<seq2seq4repair_space>auswertung_hausnummern<seq2seq4repair_space>===" + deletelastevaluationSql ) + "===<seq2seq4repair_space>with<seq2seq4repair_space>parameters<seq2seq4repair_space>1<seq2seq4repair_space>===" ) + countryid ) + "===,<seq2seq4repair_space>2<seq2seq4repair_space>===" ) + municipalityid ) + "===,<seq2seq4repair_space>3<seq2seq4repair_space>===" ) + jobid ) + "===..." ) ) ; try { deletelastevaluationStmt . setInt ( 1 , countryid ) ; deletelastevaluationStmt . setInt ( 2 , municipalityid ) ; deletelastevaluationStmt . setInt ( 3 , jobid ) ; deletelastevaluationStmt . executeUpdate ( ) ; } catch ( SQLException e ) { System . out . println ( "ERROR,<seq2seq4repair_space>when<seq2seq4repair_space>tried<seq2seq4repair_space>to<seq2seq4repair_space>delete<seq2seq4repair_space>rows<seq2seq4repair_space>for<seq2seq4repair_space>old<seq2seq4repair_space>evaluation,<seq2seq4repair_space>but<seq2seq4repair_space>import<seq2seq4repair_space>will<seq2seq4repair_space>continue" ) ; e . printStackTrace ( ) ; } deletelastevaluationStmt . close ( ) ; String deleteLastEvaluationMapResultsql = "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>exporthnr2shape" ; deleteLastEvaluationMapResultsql += "<seq2seq4repair_space>WHERE" ; deleteLastEvaluationMapResultsql += "<seq2seq4repair_space>job_id<seq2seq4repair_space>=<seq2seq4repair_space>?;" ; PreparedStatement deleteLastEvaluationMapResultStmt = batchImport . con_hausnummern . prepareStatement ( deleteLastEvaluationMapResultsql ) ; System . out . println ( "Info:<seq2seq4repair_space>delete<seq2seq4repair_space>old<seq2seq4repair_space>evaluation<seq2seq4repair_space>in<seq2seq4repair_space>table<seq2seq4repair_space>exporthnr2shape<seq2seq4repair_space>..." ) ; try { deleteLastEvaluationMapResultStmt . setInt ( 1 , jobid ) ; deleteLastEvaluationMapResultStmt . executeUpdate ( ) ; } catch ( SQLException e ) { System . out . println ( "ERROR,<seq2seq4repair_space>when<seq2seq4repair_space>tried<seq2seq4repair_space>to<seq2seq4repair_space>delete<seq2seq4repair_space>rows<seq2seq4repair_space>for<seq2seq4repair_space>old<seq2seq4repair_space>evaluation<seq2seq4repair_space>in<seq2seq4repair_space>exporthnr2shape<seq2seq4repair_space>table,<seq2seq4repair_space>but<seq2seq4repair_space>import<seq2seq4repair_space>will<seq2seq4repair_space>continue" ) ; e . printStackTrace ( ) ; } deleteLastEvaluationMapResultStmt . close ( ) ; String selectallofficialstreetsSql = "SELECT<seq2seq4repair_space>DISTINCT<seq2seq4repair_space>ON<seq2seq4repair_space>(strasse)<seq2seq4repair_space>strasse,<seq2seq4repair_space>strasse.id<seq2seq4repair_space>AS<seq2seq4repair_space>id" + ( ( ( ( "<seq2seq4repair_space>FROM<seq2seq4repair_space>stadt_hausnummern,<seq2seq4repair_space>strasse,<seq2seq4repair_space>stadt,<seq2seq4repair_space>land" + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>stadt_hausnummern.strasse_id<seq2seq4repair_space>=<seq2seq4repair_space>strasse.id" ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>stadt_hausnummern.stadt_id<seq2seq4repair_space>=<seq2seq4repair_space>stadt.id" ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>stadt_hausnummern.land_id<seq2seq4repair_space>=<seq2seq4repair_space>land.id" ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>stadt<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND<seq2seq4repair_space>land<seq2seq4repair_space>=<seq2seq4repair_space>?;" ) ; PreparedStatement selectallofficialstreetsStmt = batchImport . con_hausnummern . prepareStatement ( selectallofficialstreetsSql ) ; int numberStreetsFromOfficialList = 0 ; int numberStreetsLoadedDynamically = 0 ; int numberStreetInsertedIntoDB = 0 ; System . out . println ( "Info:<seq2seq4repair_space>get<seq2seq4repair_space>all<seq2seq4repair_space>official<seq2seq4repair_space>streets<seq2seq4repair_space>with<seq2seq4repair_space>municipality<seq2seq4repair_space>..." ) ; try { selectallofficialstreetsStmt . setString ( 1 , municipality ) ; selectallofficialstreetsStmt . setString ( 2 , country ) ; ResultSet selectallofficialstreetsRS = selectallofficialstreetsStmt . executeQuery ( ) ; while ( selectallofficialstreetsRS . next ( ) ) { if ( ! ( batchImport . street_idlist . containsKey ( selectallofficialstreetsRS . getString ( "strasse" ) ) ) ) { batchImport . street_idlist . put ( selectallofficialstreetsRS . getString ( "strasse" ) , selectallofficialstreetsRS . getInt ( "id" ) ) ; numberStreetsFromOfficialList ++ ; } } } catch ( SQLException e ) { System . out . println ( ( ( ( ( "ERROR,<seq2seq4repair_space>when<seq2seq4repair_space>tried<seq2seq4repair_space>to<seq2seq4repair_space>get<seq2seq4repair_space>all<seq2seq4repair_space>official<seq2seq4repair_space>street<seq2seq4repair_space>names<seq2seq4repair_space>from<seq2seq4repair_space>municipality<seq2seq4repair_space>===" + municipality ) + "===<seq2seq4repair_space>in<seq2seq4repair_space>country<seq2seq4repair_space>===" ) + country ) + "===" ) ) ; e . printStackTrace ( ) ; } selectallofficialstreetsStmt . close ( ) ; String selectStreetidSql = "SELECT<seq2seq4repair_space>id<seq2seq4repair_space>FROM<seq2seq4repair_space>strasse<seq2seq4repair_space>where<seq2seq4repair_space>strasse<seq2seq4repair_space>=<seq2seq4repair_space>?;" ; PreparedStatement selectStreetidStmt = batchImport . con_hausnummern . prepareStatement ( selectStreetidSql ) ; String insertstreetsql = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>strasse<seq2seq4repair_space>(strasse)<seq2seq4repair_space>VALUES<seq2seq4repair_space>(?)<seq2seq4repair_space>returning<seq2seq4repair_space>id;" ; PreparedStatement insertstreetstmt = batchImport . con_hausnummern . prepareStatement ( insertstreetsql ) ; String selectOSMStreetGeometrySql = "SELECT<seq2seq4repair_space>strasse_id<seq2seq4repair_space>AS<seq2seq4repair_space>id,<seq2seq4repair_space>strasse,<seq2seq4repair_space>jobs_strassen.linestring<seq2seq4repair_space>AS<seq2seq4repair_space>linestring900913," + ( ( ( ( ( "<seq2seq4repair_space>osm_ids,<seq2seq4repair_space>ST_IsClosed(jobs_strassen.linestring)<seq2seq4repair_space>AS<seq2seq4repair_space>linestring_isclosed" + "<seq2seq4repair_space>FROM<seq2seq4repair_space>jobs_strassen<seq2seq4repair_space>JOIN<seq2seq4repair_space>strasse" ) + "<seq2seq4repair_space>ON<seq2seq4repair_space>jobs_strassen.strasse_id<seq2seq4repair_space>=<seq2seq4repair_space>strasse.id" ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>job_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>AND" ) + "<seq2seq4repair_space>strasse_id<seq2seq4repair_space>=<seq2seq4repair_space>?" ) + "<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>correctorder(strasse);" ) ; PreparedStatement selectOSMStreetGeometryStmt = batchImport . con_hausnummern . prepareStatement ( selectOSMStreetGeometrySql ) ; String insertStreetResultSql = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>exporthnr2shape" + ( ( ( "<seq2seq4repair_space>(land_id,<seq2seq4repair_space>stadt_id,<seq2seq4repair_space>job_id,<seq2seq4repair_space>strasse,<seq2seq4repair_space>hnr_soll,<seq2seq4repair_space>hnr_osm," + "<seq2seq4repair_space>hnr_fhlosm,<seq2seq4repair_space>hnr_nurosm,<seq2seq4repair_space>hnr_abdeck,<seq2seq4repair_space>hnr_liste,<seq2seq4repair_space>timestamp,<seq2seq4repair_space>geom)" ) + "<seq2seq4repair_space>VALUES<seq2seq4repair_space>(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>now(),<seq2seq4repair_space>ST_Transform(?::geometry,<seq2seq4repair_space>4326)" ) + ");" ) ; PreparedStatement insertStreetResultStmt = batchImport . con_hausnummern . prepareStatement ( insertStreetResultSql ) ; String inserthousenumberWithGeometrySql = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>auswertung_hausnummern" + ( ( ( ( ( ( "<seq2seq4repair_space>(land_id,<seq2seq4repair_space>stadt_id,<seq2seq4repair_space>job_id,<seq2seq4repair_space>copyland,<seq2seq4repair_space>copystadt,<seq2seq4repair_space>copyjobname,<seq2seq4repair_space>copystrasse," + "<seq2seq4repair_space>strasse_id,<seq2seq4repair_space>postcode,<seq2seq4repair_space>hausnummer,<seq2seq4repair_space>hausnummer_sortierbar,<seq2seq4repair_space>treffertyp," ) + "<seq2seq4repair_space>osm_objektart,<seq2seq4repair_space>osm_id,<seq2seq4repair_space>objektart,<seq2seq4repair_space>point" ) + ")" ) + "<seq2seq4repair_space>VALUES(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?," ) + "<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?," ) + "<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>ST_Setsrid(ST_Makepoint(?,<seq2seq4repair_space>?),<seq2seq4repair_space>4326));" ) ; PreparedStatement inserthousenumberWithGeometryStmt = batchImport . con_hausnummern . prepareStatement ( inserthousenumberWithGeometrySql ) ; String inserthousenumberWithoutGeometrySql = "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>auswertung_hausnummern" + ( ( ( ( ( ( "<seq2seq4repair_space>(land_id,<seq2seq4repair_space>stadt_id,<seq2seq4repair_space>job_id,<seq2seq4repair_space>copyland,<seq2seq4repair_space>copystadt,<seq2seq4repair_space>copyjobname,<seq2seq4repair_space>copystrasse," + "<seq2seq4repair_space>strasse_id,<seq2seq4repair_space>postcode,<seq2seq4repair_space>hausnummer,<seq2seq4repair_space>hausnummer_sortierbar,<seq2seq4repair_space>treffertyp," ) + "<seq2seq4repair_space>osm_objektart,<seq2seq4repair_space>osm_id,<seq2seq4repair_space>objektart" ) + ")" ) + "<seq2seq4repair_space>VALUES(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?," ) + "<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?," ) + "<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?);" ) ; PreparedStatement inserthousenumberWithoutGeometryStmt = batchImport . con_hausnummern . prepareStatement ( inserthousenumberWithoutGeometrySql ) ; batchImport . con_hausnummern . setAutoCommit ( false ) ; HashMap < Integer , String > headerfield = new HashMap < Integer , String > ( ) ; Integer street_hittype_l = 0 ; Integer street_hittype_i = 0 ; Integer street_hittype_o = 0 ; String actStreet = "" ; String previousStreet = "" ; StringBuffer actStreetMissingHousenumbers = new StringBuffer ( ) ; int countHousenumbersIdentical = 0 ; int countHousenumbersListonly = 0 ; int countHousenumbersOsmonly = 0 ; Date loopstart = new Date ( ) ; for ( int lineindex = 0 ; lineindex < ( lines . length ) ; lineindex ++ ) { previousStreet = actStreet ; if ( ( lineindex % 1000 ) == 0 ) System . out . println ( ( "read<seq2seq4repair_space>result<seq2seq4repair_space>file<seq2seq4repair_space>line<seq2seq4repair_space>no<seq2seq4repair_space>" + lineindex ) ) ; String actline = lines [ lineindex ] ; if ( actline == "" ) continue ; if ( ( lineindex == 0 ) && ( ( actline . toLowerCase ( ) . indexOf ( "#strasse" ) ) == 0 ) ) { actline = actline . substring ( 1 ) ; String [ ] columns = actline . toLowerCase ( ) . split ( "\t" ) ; for ( int colindex = 0 ; colindex < ( columns . length ) ; colindex ++ ) { String actcolumn = columns [ colindex ] ; if ( actcolumn == "" ) continue ; headerfield . put ( colindex , actcolumn ) ; } continue ; } if ( ( actline . indexOf ( "#" ) ) == 0 ) { if ( ( actline . indexOf ( "#Para<seq2seq4repair_space>" ) ) == 0 ) { String [ ] keyvalue = actline . substring ( 6 ) . split ( "=" ) ; String key = "" ; String value = "" ; if ( ( keyvalue . length ) >= 1 ) key = keyvalue [ 0 ] ; if ( ( keyvalue . length ) >= 2 ) value = keyvalue [ 1 ] ; if ( key . equals ( "OSMTime" ) ) { osmtime = new Date ( Long . parseLong ( value ) ) ; } if ( key . equals ( "EvaluationTime" ) ) { evaluationtime = new Date ( Long . parseLong ( value ) ) ; } if ( key . equals ( "Country" ) ) { country = value ; } if ( key . equals ( "Municipality" ) ) { municipality = value ; } if ( key . equals ( "Jobname" ) ) { jobname = value ; } } continue ; } String [ ] columns = actline . split ( "\t" ) ; <START_BUG> if ( ( columns . length ) < 9 ) { <END_BUG>

Fix:
if ( ( columns . length ) < 8 ) {