oracle / oracle/oci-java-sdk

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

Open
#435 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SDK
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.