gnodet-bot commented on code in PR #30221:
URL: https://github.com/apache/camel/pull/30221#discussion_r4588364678
##########
dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/util/VersionHelper.java:
##########
@@ -124,6 +127,21 @@ public static String extractKameletsVersion() {
}
}
+ // Executable JARs do not expose their nested dependencies in
java.class.path.
+ try (InputStream is = VersionHelper.class.getResourceAsStream(
+
"/META-INF/maven/org.apache.camel.kamelets/camel-kamelets/pom.properties")) {
+ if (is != null) {
+ Properties properties = new Properties();
+ properties.load(is);
+ String version = properties.getProperty("version");
+ if (ObjectHelper.isNotEmpty(version)) {
+ return version;
+ }
+ }
+ } catch (IOException e) {
Review Comment:
🔵 **Low:** Silent `IOException` suppression gives no diagnostic signal when
the metadata file exists but cannot be read (permissions error, truncated
stream, encoding issue). In a launcher environment this is particularly hard to
debug. Consider logging at debug level:
```suggestion
} catch (IOException e) {
LOG.debug("Could not read bundled Kamelets catalog metadata,
using default version", e);
}
```
This requires a `private static final Logger LOG =
LoggerFactory.getLogger(VersionHelper.class);` field if one does not already
exist in the class.
--
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]