RFR: 8279673: AudioClip.play doesn't work due to NullPointerException when creating DataPusher [v2]
Andrey Turbanov
aturbanov at openjdk.java.net
Mon Jan 24 18:17:52 UTC 2022
> 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.
Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
8279673: AudioClip.play doesn't work due to NullPointerException when creating DataPusher
add test metadata
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/6382/files
- new: https://git.openjdk.java.net/jdk/pull/6382/files/50ab0d31..ac67b9e2
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6382&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6382&range=00-01
Stats: 10 lines in 3 files changed: 7 ins; 0 del; 3 mod
Patch: https://git.openjdk.java.net/jdk/pull/6382.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6382/head:pull/6382
PR: https://git.openjdk.java.net/jdk/pull/6382
More information about the client-libs-dev
mailing list