On Mon, 8 Jun 2026 02:04:55 GMT, Sergey Bylokhov <[email protected]> wrote:

>> 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?

I've added null checks before de-refing in osc_stream in SoftVoice.java

The getChannels() call you cite is presumably the one a few lines below (line 
628) not above. I don't know that it is needed but I've made the implementation 
of it return "1" if getFormat() is null. I think in general as a policy  it 
ought not to be possible to reach paths which require a stream if there is none.

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

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

Reply via email to