[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Integrated: 8279673: AudioClip.play doesn't work due to NullPointerException when creating DataPushe
From:       Andrey Turbanov <aturbanov () openjdk ! java ! net>
Date:       2022-01-27 7:04:33
Message-ID: MeLImWnNLfvSDfhHM20Q-pu6wwdqqmWbDWH5VaeeIqU=.d3aaedfd-afb8-4715-85ec-601afb6cdd2b () github ! com
[Download RAW message or body]

On Sun, 14 Nov 2021 20:02:27 GMT, Andrey Turbanov <aturbanov@openjdk.org> wrote:

> There is possible NPE, when trying to play AudioClip
> 
> import java.applet.AudioClip;
> import java.io.IOException;
> import java.net.URL;
> 
> 
> public class AudioNpe {
> public static void main(String[] args) throws IOException, InterruptedException {
> URL url = new URL("https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_1MG.wav");
>  AudioClip content = (AudioClip)url.getContent();
> content.play();
> 
> Thread.sleep(10000L);
> }
> }
> 
> 
> 	  at java.lang.Thread.<init>(Thread.java:393)
> 	  at java.lang.Thread.<init>(Thread.java:760)
> 	  at com.sun.media.sound.JSSecurityManager.createThread(JSSecurityManager.java:115)
>   at com.sun.media.sound.DataPusher.start(DataPusher.java:117)
> 	  - locked <0x955> (a com.sun.media.sound.DataPusher)
> 	  at com.sun.media.sound.JavaSoundAudioClip.startImpl(JavaSoundAudioClip.java:202)
> 	  - locked <0x95e> (a com.sun.media.sound.JavaSoundAudioClip)
> 	  at com.sun.media.sound.JavaSoundAudioClip.play(JavaSoundAudioClip.java:152)
> 	  at main.java.AudioNpe.main(AudioNpe.java:12)
> 
> 
> It happens because of bug in `com.sun.media.sound.JSSecurityManager#createThread` \
> implementation: variable `String name`, which supposed to be used - actually unused \
> and `null` thread name is passed to `Thread` constructor. 
> After fix - audio clip plays without problems.

This pull request has now been integrated.

Changeset: 2ea0edf2
Author:    Andrey Turbanov <aturbanov@openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/2ea0edf2c40edde4c191864a40e7a4d741ac0b8e
                
Stats:     93 lines in 3 files changed: 89 ins; 1 del; 3 mod

8279673: AudioClip.play doesn't work due to NullPointerException when creating \
DataPusher

Reviewed-by: prr, serb

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

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic