diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipper.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipper.java index 9ca06f3224d..3cf0053c76f 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipper.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipper.java @@ -21,6 +21,9 @@ public class MigrationTaskSkipper { } Set skippedVersionSet = Stream.of(theSkipVersions.split(",")) .map(String::trim) + // TODO KHS filter out all characters that aren't numbers, periods and underscores + .map(s -> s.replace("'", "")) + .map(s -> s.replace("\"", "")) .filter(StringUtils::isNotBlank) .collect(Collectors.toSet()); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipperTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipperTest.java index fe18bd45fff..b1d3a4db886 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipperTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/MigrationTaskSkipperTest.java @@ -50,6 +50,12 @@ public class MigrationTaskSkipperTest { assertSkipped(myTasks, 4); } + @Test + public void skipTwo() { + MigrationTaskSkipper.setDoNothingOnSkippedTasks(myTasks, VERSION_PREFIX + 2 + "," + VERSION_PREFIX + 3); + assertSkipped(myTasks, 2, 3); + } + @Test public void skipWeirdSpacing() { MigrationTaskSkipper.setDoNothingOnSkippedTasks(myTasks, " " + VERSION_PREFIX + 2 + " , " + VERSION_PREFIX + 3 + " "); @@ -68,6 +74,24 @@ public class MigrationTaskSkipperTest { assertSkipped(myTasks, 2, 3); } + @Test + public void quoted() { + MigrationTaskSkipper.setDoNothingOnSkippedTasks(myTasks, "\"" + VERSION_PREFIX + 2 + "," + VERSION_PREFIX + 3 + "\""); + assertSkipped(myTasks, 2, 3); + } + + @Test + public void allQuoted() { + MigrationTaskSkipper.setDoNothingOnSkippedTasks(myTasks, "\"" + VERSION_PREFIX + 2 + "\",\"" + VERSION_PREFIX + 3 + "\""); + assertSkipped(myTasks, 2, 3); + } + + @Test + public void oneQuoted() { + MigrationTaskSkipper.setDoNothingOnSkippedTasks(myTasks, "\"" + VERSION_PREFIX + 2 + "\"" ); + assertSkipped(myTasks, 2); + } + @Test public void endComma() { MigrationTaskSkipper.setDoNothingOnSkippedTasks(myTasks, VERSION_PREFIX + 2 + "," + VERSION_PREFIX + 3 + ",");