src/main/java/com/conveyal/gtfs/loader/JdbcGtfsLoader.java
private TableLoadResult load (Table table) {
        // This object will be returned to the caller to summarize the contents of the table and any errors.
        TableLoadResult tableLoadResult = new TableLoadResult();
        int initialErrorCount = errorStorage.getErrorCount();
        try {
            tableLoadResult.rowCount = loadInternal(table);
            tableLoadResult.fileSize = getTableSize(table);
            LOG.info(String.format("loaded in %d %s records", tableLoadResult.rowCount, table.name));
        } catch (Exception ex) {
            LOG.error("Fatal error loading table", ex);
            tableLoadResult.fatalException = ex.toString();
            // Rollback connection so that fatal exception does not impact loading of other tables.
            try {
                connection.rollback();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        } finally {
            // Explicitly delete the tmp file now that load is finished (either success or failure).
            // Otherwise these multi-GB files clutter the drive.
            if (tempTextFile != null) {
                tempTextFile.delete();
            }
        }
        int finalErrorCount = errorStorage.getErrorCount();
        tableLoadResult.errorCount = finalErrorCount - initialErrorCount;
        return tableLoadResult;
    }
private TableLoadResult load (Table table) {
        // This object will be returned to the caller to summarize the contents of the table and any errors.
        TableLoadResult tableLoadResult = new TableLoadResult();
        int initialErrorCount = errorStorage.getErrorCount();
        try {
            tableLoadResult.rowCount = loadInternal(table);
            tableLoadResult.fileSize = getTableSize(table);
            LOG.info(String.format("loaded in %d %s records", tableLoadResult.rowCount, table.name));
        } catch (Exception ex) {
            LOG.error("Fatal error loading table", ex);
            tableLoadResult.fatalException = ex.toString();
            // Rollback connection so that fatal exception does not impact loading of other tables.
            try {
                connection.rollback();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        } finally {
            // Explicitly delete the tmp file now that load is finished (either success or failure).
            // Otherwise these multi-GB files clutter the drive.
            if (tempTextFile != null) {
                tempTextFile.delete();
            }
        }
        int finalErrorCount = errorStorage.getErrorCount();
        tableLoadResult.errorCount = finalErrorCount - initialErrorCount;
        return tableLoadResult;
    }
private TableLoadResult load ( Table table ) { // This object will be returned to the caller to summarize the contents of the table and any errors. TableLoadResult tableLoadResult = new TableLoadResult ( ) ; int initialErrorCount = errorStorage . getErrorCount ( ) ; try { tableLoadResult . rowCount = loadInternal ( table ) ; tableLoadResult . fileSize = getTableSize ( table ) ; LOG . info ( String . format ( "loaded in %d %s records" , tableLoadResult . rowCount , table . name ) ) ; } catch ( Exception ex ) { LOG . error ( "Fatal error loading table" , ex ) ; tableLoadResult . fatalException = ex . toString ( ) ; // Rollback connection so that fatal exception does not impact loading of other tables. try { connection . rollback ( ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; } } finally { // Explicitly delete the tmp file now that load is finished (either success or failure). // Otherwise these multi-GB files clutter the drive. if ( tempTextFile != null ) { tempTextFile . delete ( ) ; } } int finalErrorCount = errorStorage . getErrorCount ( ) ; tableLoadResult . errorCount = finalErrorCount - initialErrorCount ; return tableLoadResult ; }
This wraps the main internal table loader method to catch exceptions and figure out how many errors happened.
This wraps the main internal table loader method to catch exceptions and figure out how many errors happened .