JDK-4827559 : unspecified NullPointerException in javax.sound.sampled.Mixer.open()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2,5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2003-03-05
  • Updated: 2004-03-12
  • Resolved: 2003-09-27
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.
Other
5.0 tigerFixed
Description

Name: dkR10031			Date: 03/05/2003



The current reference implementation (JDK 1.4.2beta, build b17)   
of the javax.sound.sampled.Mixer.open() throws unspecified 
NullPointerException when computer has not an audio device. 
Note, that prior to JDK 1.4.2beta build 12 LineUnavailableException was 
thrown.

The J2SE specification does not specify NullPointerException for this 
method. However, LineUnavailableException is specified if the line cannot 
be opened due to resource restrictions:
"
open()
....
LineUnavailableException - if the line cannot be opened due to resource 
restrictions.
...
"

This behavior seems quite questionable.

This bug causes failure of JCK test:
api/javax_sound/sampled/Mixer/index.html#open[open001].

To reproduce the bug run the following test with JDK build 1.4.2-beta-b17:
------------------ example code begin --------------------------
import javax.sound.sampled.*;

public class MyMixer {
    public static void main(String args[]) {
        Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
        for( int i=0; i<mixerInfo.length; i++ ) {
            Mixer testedMixer = null;
            try {
                testedMixer = AudioSystem.getMixer(mixerInfo[i]);
                System.out.println(mixerInfo[i]);
                testedMixer.open();
            } catch (NullPointerException npe) {
                System.out.println("NPE:" + npe.getMessage());
            } catch (LineUnavailableException ule) {
                System.out.println("ULE:" + ule.getMessage());
            }
        }
    }
}
------------------ example code end ----------------------------
------------------ JDK 1.4.2beta build 17 log begin ------------
bash-2.03$ uname -a
SunOS novo148 5.8 Generic_108528-18 sun4u sparc SUNW,Ultra-80
bash-2.03$ /export/ld25/java/dest/jdk1.4.2-b17/solaris-sparc/bin/java -showversion MyMixer
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b17)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b17, mixed mode)

Java Sound Audio Engine, version 1.0
ULE:Audio Device Unavailable
SolarisOS,dev/audio,multi threaded, version Unknown Version
NPE:null
------------------ JDK 1.4.2beta build 17 log end --------------
------------------ JDK 1.4.2beta build 11 log begin ------------
bash-2.03$ uname -a
SunOS novo148 5.8 Generic_108528-18 sun4u sparc SUNW,Ultra-80
bash-2.03$ /export/ld25/java/dest/jdk1.4.2-b11/solaris-sparc/bin/java -showversion MyMixer
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b11)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b11, mixed mode)

Java Sound Audio Engine, version 1.0
ULE:Audio Device Unavailable
SolarisOS,dev/audio,multi threaded, version Unknown Version
ULE:Unexpected Error                       
------------------ JDK 1.4.2beta build 11 log end --------------                       

======================================================================
###@###.### 2003-08-13
Nither ULE or NPE thrown when running test on version 1.5.0-beta-b10.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b22 VERIFIED IN: tiger-b41
14-06-2004

PUBLIC COMMENTS unspecified NullPointerException in javax.sound.sampled.Mixer.open()
10-06-2004

EVALUATION ###@###.### 2003-03-06 Should be easy to fix. ###@###.### 2003-09-26 Should be fixed with 4915810: 2 Regression-test sound fails: NPE from Mixer.open().
06-03-2003