Skip to content

Commit

Permalink
Merge pull request #229 from conveyal/remove-backslash-error
Browse files Browse the repository at this point in the history
Do not log error for unescaped backslashes
  • Loading branch information
landonreed authored May 2, 2019
2 parents 945a0e9 + d53b6a3 commit f1c46da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/conveyal/gtfs/loader/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public String getSqlDeclaration() {
return String.join(" ", name, getSqlTypeName());
}

// TODO test for input with tabs, newlines, carriage returns, and slashes in it.
protected static ValidateFieldResult<String> cleanString (String string) {
return cleanString(new ValidateFieldResult<>(string));
}
Expand All @@ -106,7 +105,12 @@ protected static ValidateFieldResult<String> cleanString (ValidateFieldResult<St
result.clean = result.clean.replace(illegalChar.illegalSequence, illegalChar.replacement);
// We don't know the Table or line number here, but when the errors bubble up, these values should be
// assigned to the errors.
result.errors.add(NewGTFSError.forFeed(NewGTFSErrorType.ILLEGAL_FIELD_VALUE, illegalChar.description));
if (!illegalChar.illegalSequence.equals("\\")) {
// Do not include error entry for unescaped backslash. While this character
// sequence is problematic for Postgres, it is not technically an illegal
// value according to the GTFS specification.
result.errors.add(NewGTFSError.forFeed(NewGTFSErrorType.ILLEGAL_FIELD_VALUE, illegalChar.description));
}
}
}
return result;
Expand Down

0 comments on commit f1c46da

Please sign in to comment.