Skip to content

Commit

Permalink
refactor(exceptions): address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-cline committed Jul 5, 2023
1 parent fbd40a3 commit bc1e1b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/conveyal/gtfs/loader/StringListField.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public ValidateFieldResult<String> validateAndConvert(String original) {

@Override
public Set<NewGTFSError> setParameter(PreparedStatement preparedStatement, int oneBasedIndex, String string) {
// FIXME
try {
// Only split on commas following an escaped quotation mark, as this indicates a new item in the list.
String[] stringList = string.split("(?<=\"),");
// Clean the string list of any escaped quotations which are required to preserve any internal commas
// Clean the string list of any escaped quotations which are required to preserve any internal commas.
stringList = Arrays.stream(stringList).map(s -> s.replace("\"", "")).toArray(String[]::new);
Array array = preparedStatement.getConnection().createArrayOf("text", stringList);
preparedStatement.setArray(oneBasedIndex, array);
Expand Down

0 comments on commit bc1e1b7

Please sign in to comment.