Inability to load sdk.properties leads to NPE instead of "Unknown"
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 243
- Forks
- 171
- Avg merge
- 30m
- Merged PRs (30d)
- 4
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bmc-common/src/main/java/com/oracle/bmc/ClientRuntime.java, at sdkVersion() and the propertyStream handling around line 93. Reproduce the missing sdk.properties case and verify that it reports "Unknown" rather than throwing a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100