Skip to content

Commit 2d3ec78

Browse files
committed
[bugfix] WebDAV API should read default config before user-specific config
1 parent 4b5faa5 commit 2d3ec78

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

extensions/webdav/src/main/java/org/exist/webdav/ExistResourceFactory.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,21 @@ public ExistResourceFactory() {
7171

7272
// load specific options
7373
try {
74+
// 1) try and read default config from classpath
75+
try (final InputStream is = getClass().getResourceAsStream("webdav.properties")) {
76+
if (is != null) {
77+
LOG.info("Read default WebDAV configuration from classpath");
78+
webDavOptions.load(is);
79+
} else {
80+
LOG.warn("Unable to read default WebDAV configuration from the classpath.");
81+
}
82+
}
83+
} catch (final Throwable ex) {
84+
LOG.error(ex.getMessage());
85+
}
7486

75-
// Find right file
87+
try {
88+
// 2) try and find overridden config relative to EXIST_HOME/etc
7689
final Optional<Path> eXistHome = brokerPool.getConfiguration().getExistHome();
7790
final Path config = FileUtils.resolve(eXistHome, "etc").resolve("webdav.properties");
7891

@@ -82,12 +95,8 @@ public ExistResourceFactory() {
8295
try (final InputStream is = Files.newInputStream(config)) {
8396
webDavOptions.load(is);
8497
}
85-
86-
} else {
87-
LOG.info("Using eXist-db default serialization options.");
8898
}
89-
90-
} catch (Throwable ex) {
99+
} catch (final Throwable ex) {
91100
LOG.error(ex.getMessage());
92101
}
93102

File renamed without changes.

0 commit comments

Comments
 (0)