On Wed, 27 May 2026 17:31:57 GMT, Phil Race <[email protected]> wrote:

>> A fix for a theoretical NPE because a method might return null and it is 
>> used.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java line 
> 205:
> 
>> 203:             try (InputStream is = getInputStream()) {
>> 204:                 if (is == null) {
>> 205:                    throw new IOException("null stream");
> 
> This was the actual complaint

That `getInputStream` method is used in a few other places that can also not be 
ready for null.
It can return null because it catches the IOException and returns null instead. 
Maybe it would be better to just throw the IOException there, instead of 
returning null and then checking and throwing?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/31299#discussion_r3312710435

Reply via email to