Closed wjw465150 closed 1 year ago
i found The problem was found in the method"getConfigStream",this is i fixed code:
private InputStream getConfigStream(String resourceLocation) throws FileNotFoundException {
ClassLoader ctxClsLoader = Thread.currentThread().getContextClassLoader();
InputStream is = null;
if (resourceLocation.startsWith("classpath:")) {
resourceLocation = resourceLocation.substring(10);
if (ctxClsLoader != null) {
is = ctxClsLoader.getResourceAsStream(resourceLocation);
}
if (is == null && !resourceLocation.equals(CONFIG_FILE)) {
is = new FileInputStream(resourceLocation);
} else if (is == null && resourceLocation.equals(CONFIG_FILE)) {
is = getClass().getClassLoader().getResourceAsStream(resourceLocation);
if (is == null) {
is = getClass().getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE);
}
}
} else {
try {
is = new FileInputStream(resourceLocation);
} catch (FileNotFoundException fileEx) {
if (ctxClsLoader != null) {
is = ctxClsLoader.getResourceAsStream(resourceLocation);
}
if (is == null && resourceLocation.equals(CONFIG_FILE)) {
is = getClass().getClassLoader().getResourceAsStream(resourceLocation);
if (is == null) {
is = getClass().getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE);
}
}
}
}
return is;
}
I have submitted a request on this issue: fix can not use a custom configuration from the classpath.
Questions
when i use a custom configuration from the classpath
Throw an exception:
Version
io.vertx:vertx-zookeepe:4.3.8
screenshot