'mark/reset exception during getAudioInputStream()

I posted a fix of a problem (explained below) but haven't been able to confirm if it solves the problem. Would someone with Java 7 try the out the following Applet and report back? It would be MUCH appreciated.

AudioMixerDemo

The problem that was reported to me was that the top row of buttons which require the load of a sound clip from a jarred resource are not working. The error points to the line where the audio file is being read and says a "mark/reset" I/O exception is being thrown.

This code works for Java 6 is not working for Java 7. The offending statement follows:

AudioInputStream ais = AudioSystem.getAudioInputStream(
    AudioMixer.class.getResourceAsStream(fileName));

The inner area returns an InputStream, and I think that is where the "markability" issue arises. The issue was reported at Oracle's bug database as a backwards compatibility problem, but given a low priority.

I have recoded the above as follows:

URL url = AudioMixer.class.getResource(fileName);
AudioInputStream ais =  AudioSystem.getAudioInputStream(url); 

There is nothing in the AudioSystem API that mentions that this method will throw "mark/reset" I/O exceptions. So, I am hopeful. But I haven't been able to confirm this!



Solution 1:[1]

The Java 7 user who reported the problem has contacted me and given a thumbs up. So I am presuming the diagnosis and fix of the backwards compatibility problem are correct, and no longer am seeking testers (unless you are just interested in checking out the AudioMixer).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Phil Freihofner