JDK-8177428 : [test] Ensemble cannot play AudioClip files when running in Java 8 and hosted over http
  • Type: Bug
  • Component: javafx
  • Sub-Component: samples
  • Affected Version: 8u121,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2017-03-22
  • Updated: 2020-01-31
  • Resolved: 2017-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u152Fixed 9Fixed
Related Reports
Relates :  
Description
When the Ensemble8 jar file is placed online and launched via Java Web Start, the AudioClip and 3D Xylophone samples don't play any sounds. This appears to be a bug in Java 8 that has been fixed in Java 9. A workaround is to check for the clip files in a resources directory next to the jar file and use those if found, otherwise fall back on the current method of using Class.getResource().
Comments
changeset: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/a90b71e07004 date: Thu Mar 23 09:21:19 2017 -0700 summary: 8177428: [test] Ensemble cannot play AudioClip files when running in Java 8 and hosted over http
23-03-2017

Since the backport will apply cleanly and it is needed for JDK 8, this is also approved to push to 8u-dev for 8u152.
23-03-2017

Looks good to me. +1 (for 9-dev)
23-03-2017

Webrev: http://cr.openjdk.java.net/~ddehaven/8177428/rt.v0/
23-03-2017

When I set -Djfxmedia.loglevel=debug, I see this in the log (base URL redacted): Debug (0:00:00:114): Creating AudioClip for URI jar:http://<host>/Ensemble/Ensemble.jar!/ensemble/samples/shared-resources/Note2.wav Debug (0:00:00:124): New cache entry: URI jar:http://<host>/Ensemble/Ensemble.jar!/ensemble/samples/shared-resources/Note2.wav, buffer java.nio.DirectByteBuffer[pos=33270 lim=17565661 cap=17565661], MIME type audio/x-wav Notice the limit and capacity of the DirectByteBuffer is set to the size of the jar file, not the resource. I don't know if this is a bug in JDK or FX media (it could be something wrong in ConnectionHolder.java), but it's causing it to never finish loading the resource as it's *actually* finished but it thinks there's more. In Java 9, this does not happen, limit and capacity are the correct sizes and the clips load and play normally.
22-03-2017