zregvart commented on a change in pull request #5:
URL: https://github.com/apache/camel-kameleon/pull/5#discussion_r669443557
##########
File path:
src/main/java/org/apache/camel/kameleon/config/ConfigurationResource.java
##########
@@ -68,7 +68,7 @@ public KameleonConfiguration getKc() {
private void readConfiguration() {
if (kc == null) {
- try (InputStream inputStream =
getClass().getResourceAsStream("/kameleon.json");
+ try (InputStream inputStream =
getClass().getClassLoader().getResourceAsStream("/kameleon.json");
Review comment:
This is exactly the same as when using `Class::getResourceAsStream`, see
[the source of
java.lang.Class](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/Class.java#L2845-L2851).
This line will not throw a `NullPointerException`, but in general this pattern
is not favorable instead of `Class::getResourceAsStream` as
`Class::getClassLoader` can return `null` for primitive, `void` or classes
loaded by the base classloader.
--
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]