Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add route GTFS shortnames to pattern stop error message #396

Merged
merged 7 commits into from
Sep 27, 2023
9 changes: 7 additions & 2 deletions src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,11 @@ private String[] parseExceptionListField(int id, String namespace, Table table,
return parsedString.replaceAll("[{}]", "").split("[,]", 0);
}

private String getResultSetString(int column, ResultSet resultSet) throws java.sql.SQLException {
String resultSetString = resultSet.getString(column);
return resultSetString == null ? "" : resultSetString;
}

/**
* Delete all entries in calendar dates associated with a schedule exception.
*/
Expand Down Expand Up @@ -1579,7 +1584,7 @@ private void updateReferencingTables(
connection.rollback();
if (entityClass.getSimpleName().equals("Stop")) {
String patternStopLookup = String.format(
"select distinct p.id, r.id " +
"select distinct p.id, r.id, r.route_short_name, r.route_id " +
"from %s.pattern_stops ps " +
"inner join " +
"%s.patterns p " +
Expand All @@ -1599,7 +1604,7 @@ private void updateReferencingTables(
ResultSet resultSet = patternStopSelectStatement.getResultSet();
while (resultSet.next()) {
patternAndRouteIds.add(
"{" + resultSet.getString(1) + "-" + resultSet.getString(2) + "}"
"{" + getResultSetString(1, resultSet) + "-" + getResultSetString(2, resultSet) + "-" + getResultSetString(3, resultSet)+ "-" + getResultSetString(4, resultSet) + "}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace all of these concatenations with String.format ?

);
}
}
Expand Down
Loading