reschke commented on code in PR #279:
URL:
https://github.com/apache/jackrabbit-filevault/pull/279#discussion_r1117250453
##########
vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/AbstractExporter.java:
##########
@@ -398,6 +400,28 @@ private static PackageType
detectPackageType(WorkspaceFilter filter) {
return PackageType.MIXED;
}
+ /**
+ * Returns the version of an Oak module.
+ *
+ * @param moduleName the name of the module
+ * @param clazz a class of the module
+ * @return the version (or "SNAPSHOT" when unknown)
+ */
+ private String getVersion(String moduleName, Class<?> clazz) {
+ // borrowed from oak-commons
+ String version = "SNAPSHOT"; // fallback
+ try (InputStream stream = clazz
+
.getResourceAsStream("/META-INF/maven/org.apache.jackrabbit.vault/" +
moduleName + "/pom.properties")) {
+ if (stream != null) {
+ Properties properties = new Properties();
+ properties.load(stream);
+ return properties.getProperty("version", version);
+ }
+ } catch (IOException ignored) {
Review Comment:
Well, we are reading from a stream.
I think best effort is perfectly ok here (but we could log the exception).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]