On Mon, 1 Jun 2026 19:53:50 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).
>
> Phil Race has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8385017

src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java 
line 101:

> 99:             if (stream == null) {
> 100:                 throw new IOException("null stream");
> 101:             }

This method is used in SoftVoice.processControlLogic and if IOException is 
thrown in this place it is catched in 
https://github.com/openjdk/jdk/blob/a1ff7b16d40f543add5f815da8a80bdd1dc86224/src/java.desktop/share/classes/com/sun/media/sound/SoftVoice.java#L622,
 so initialization of osc_stream is skipped and it can cause NPE later?

It also would be good to check how the osc.getChannels() a few lines above will 
work if the stream inside of osc is null(was not open)? Possibly this can be 
validated by some unit test?

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

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

Reply via email to