Skip to content

Commit 1e83242

Browse files
committed
Adding to readVersionFromResource the ability to load from a different classloader for those cases when the thread is running in a different classloader
1 parent b8fbc64 commit 1e83242

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

clickhouse-client/src/main/java/com/clickhouse/client/config/ClickHouseClientOption.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,17 @@ public static String readVersionFromResource(String resourceFilePath) {
532532
tmpVersion = tmp;
533533
}
534534
} catch (Exception e) {
535-
// ignore
535+
try(InputStream in = ClickHouseClientOption.class.getClassLoader().getResourceAsStream(resourceFilePath)) {
536+
Properties p = new Properties();
537+
p.load(in);
538+
539+
String tmp = p.getProperty("version");
540+
if (tmp != null && !tmp.isEmpty() && !tmp.equals("${revision}")) {
541+
tmpVersion = tmp;
542+
}
543+
} catch (Exception ee) {
544+
// ignore
545+
}
536546
}
537547
return tmpVersion;
538548
}

0 commit comments

Comments
 (0)