diff --git a/src/main/java/com/conveyal/gtfs/loader/EntityPopulator.java b/src/main/java/com/conveyal/gtfs/loader/EntityPopulator.java index 67b6a88c8..4d6124509 100644 --- a/src/main/java/com/conveyal/gtfs/loader/EntityPopulator.java +++ b/src/main/java/com/conveyal/gtfs/loader/EntityPopulator.java @@ -258,9 +258,12 @@ static URL getUrlIfPresent (ResultSet resultSet, String columnName, static double getDoubleIfPresent (ResultSet resultSet, String columnName, TObjectIntMap columnForName) throws SQLException { int columnIndex = columnForName.get(columnName); - // FIXME: if SQL value is null, resultSet.getInt will return 0. Should return value equal 0 if column is missing? if (columnIndex == 0) return Entity.DOUBLE_MISSING; - else return resultSet.getDouble(columnIndex); + double doubleValue = resultSet.getDouble(columnIndex); + // If SQL value for column was null, resultSet.getDouble will return 0.0. If this is the case, override value with + // DOUBLE_MISSING. + if (resultSet.wasNull()) return Entity.DOUBLE_MISSING; + else return doubleValue; } static int getIntIfPresent (ResultSet resultSet, String columnName,