Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4827559

unspecified NullPointerException in javax.sound.sampled.Mixer.open()

    Details

    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      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.

        Attachments

          Activity

            People

            • Assignee:
              fbomerssunw Florian Bomers (Inactive)
              Reporter:
              dimasunw Dima Dima (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: