RFR: 8269091: javax/sound/sampled/Clip/SetPositionHang.java failed with ArrayIndexOutOfBoundsException: Array index out of range: -4 [v2]

Phil Race prr at openjdk.java.net
Fri Feb 11 23:28:45 UTC 2022


On Fri, 11 Feb 2022 05:17:17 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8269091: javax/sound/sampled/Clip/SetPositionHang.java failed with ArrayIndexOutOfBoundsException: Array index out of range: -4
>
> src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java line 1300:
> 
>> 1298:                 }
>> 1299:                 while (doIO && thread == curThread) {
>> 1300:                     synchronized (this) {
> 
> Maybe instead of synchronization we can read it to the local variable,then use, then reset to -1? This class already has many different locks used for synchronization and this one add another one for "this".

I suppose both should avoid this specific problem. But yes, there's a lot of synchronization in this class.
FIx updated.

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

PR: https://git.openjdk.java.net/jdk/pull/7436



More information about the client-libs-dev mailing list