diff --git a/jOOQ/src/main/java/org/jooq/FilePattern.java b/jOOQ/src/main/java/org/jooq/FilePattern.java index e418e7d173..e0ce94aa34 100644 --- a/jOOQ/src/main/java/org/jooq/FilePattern.java +++ b/jOOQ/src/main/java/org/jooq/FilePattern.java @@ -227,14 +227,20 @@ public final class FilePattern { loaded = true; } else { - String prefix = pattern.replaceAll("[*?].*", ""); - file = new File(basedir, prefix).getAbsoluteFile(); + + // [#9726] The wildcard could be in the middle of a path segment, which + // has to be ignored, e.g. the prefix of a/b*/c is a/ + String prefix = pattern.replaceAll("[^\\/]*?[*?].*", ""); + file = new File(prefix); + + if (!file.isAbsolute()) + file = new File(basedir, prefix).getAbsoluteFile(); Pattern regex = Pattern.compile("^.*?" + pattern .replace("\\", "/") .replace(".", "\\.") - .replace("?", ".") + .replace("?", "[^/]") .replace("**", ".+?") .replace("*", "[^/]*") + "$" @@ -285,6 +291,11 @@ public final class FilePattern { } } + @Override + public String toString() { + return pattern; + } + /** * A callback interface that allows for loading a {@link Source}. */