Skip to content

Commit 2e40309

Browse files
committed
concatenate /*.json instead of using Path.resolve
This is needed because resolve fails on windows due to invalid path character *. Note that we can safely concatenate /*.json (with the initial slash) because Path.of() removes any trailing slashes.
1 parent 24d6cda commit 2e40309

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/org/fairdatapoint/config/BootstrapConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() {
8181
log.info("Looking for db fixtures in the following directories: {}",
8282
String.join(", ", this.bootstrap.getDbFixturesDirs()));
8383
for (String fixturesDir : this.bootstrap.getDbFixturesDirs()) {
84-
String locationPattern = "file:" + Path.of(fixturesDir).resolve(".json");
85-
// ugly workaround for Path.resolve("*.json") failure on windows
86-
locationPattern = locationPattern.replaceAll(".json$", "*.json");
84+
// Path.of() removes trailing slashes, so it is safe to concatenate "/*.json".
85+
// Note that Path.of(fixturesDir).resolve("*.json") could work on unix but fails on windows.
86+
String locationPattern = "file:" + Path.of(fixturesDir) + "/*.json";
8787
resources.addAll(List.of(resourceResolver.getResources(locationPattern)));
8888
}
8989
// remove resources that have been applied already

0 commit comments

Comments
 (0)