On Tue, 28 Jul 2026 22:15:46 GMT, Sergey Bylokhov <[email protected]> wrote:

>> 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.
>
> Seems that is not enough. osc_stream can be initialized before to non-null 
> value(it is never reassigned back to null). And when IOException will be 
> thrown in the "SoftVoice.processControlLogic->resampler.open()" we can get 
> non-null osc_stream and resampler with null stream, when this resampler will 
> be used an NPE can occur.
> 
>>  Exception in thread "JitterCorrector" java.lang.NullPointerException:
>     Cannot invoke "com.sun.media.sound.AudioFloatInputStream.close()" because 
> "this.stream" is null
>     at 
> com.sun.media.sound.SoftAbstractResampler$ModelAbstractResamplerStream.close(SoftAbstractResampler.java:387)
>     at com.sun.media.sound.SoftVoice.processControlLogic(SoftVoice.java:590)

I've updated the code to reset osc_stream to null.

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

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

Reply via email to