oracle/oci-java-sdk

Inability to load sdk.properties leads to NPE instead of "Unknown"

andrejusc opened this issue · 1 comments

This was initially observed for OCI Java SDK v2.30.0, but looking at code for v2.41.1 it could still happen in this class and line:
https://github.com/oracle/oci-java-sdk/blob/v2.41.1/bmc-common/src/main/java/com/oracle/bmc/ClientRuntime.java#L93
i.e. this one:

propertyStream.close();

as if sdk.properties resource is not found within Jar/classpath/etc. - then stream will be null and trying to close it will result in exception, which is not captured, like such:

java.lang.NullPointerException: inStream parameter is null
	at java.base@17.0.4/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base@17.0.4/java.util.Properties.load(Properties.java:407)
	at oci.java.sdk.common@2.30.0/com.oracle.bmc.ClientRuntime.sdkVersion(ClientRuntime.java:88)

Hello,

Our team will take a look and get back to you. Thanks for reporting the issue.