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

Unexpected IAE raised while getting TargetDataLine

    Details

    • Subcomponent:
    • Resolved In Build:
      b44
    • CPU:
      x86
    • OS:
      linux

      Description



      Name: izR10247 Date: 12/05/2003



      Current J2SE 1.5 b30 spec states following:
      "
      Interface Mixer

      getTargetLineInfo

      Line.Info[] getTargetLineInfo()

          Obtains information about the set of target lines supported by this
      mixer. Some target lines may only be available when this mixer is open.

          Returns:
              array of Line.Info objects representing target lines for this
      mixer. If no target lines are supported, an array of length 0 is returned.
      "

      However JDK1.5 b29 implementation raised unexpected
      IllegalArgumentException while the test below tryes to
      get target line using Line.Info array returned by
      getTargetLineInfo().

      This bug is reproducible on Linux when the user has no access
      to sound services in a case of remote login (for users which do not
      login to X-Windows).

      The Mixer should not return any info about the
      lines that is supported but is not actually accessible
      in this case.

      This bug affects following JCK 1.5 b11 tests:

      api/javax_sound/AudioInputStream/index.html#Ctor[Ctor003]
      api/javax_sound/AudioSystem/index.html#getLine[getLine001,getLine003,getLine004]
      api/javax_sound/Mixer/index.html#Mixer[Mixer2002]
      api/javax_sound/sampled/Mixer/index.html#getLine[getLine002]

      To reproduce this bug please start the test using
      script 'MyTest.sh' below:

      =============== MyTest.java source begin ===============
      import javax.sound.sampled.*;

      public class MyTest {

          public static void main(String argv[]) {
              Mixer.Info [] infos = AudioSystem.getMixerInfo();

              for (int i=0; i<infos.length; i++) {
                  Mixer mixer = AudioSystem.getMixer(infos[i]);
                  System.out.println("Mixer is: " + mixer);
                  Line.Info [] target_line_infos = mixer.getTargetLineInfo();
                  for (int j = 0; j < target_line_infos.length; j++) {
                      try {
                          System.out.println("Trying to get:" + target_line_infos[j]);
                          mixer.getLine(target_line_infos[j]);
                      } catch (IllegalArgumentException iae) {
                          System.out.println("Unexpected IllegalArgumentException raised:" + iae);
                          iae.printStackTrace();
                      } catch (LineUnavailableException lue) {
                          System.out.println("Unexpected IllegalArgumentException raised:" + lue);
                          lue.printStackTrace();
                      }
                  }
              }
          }
      }
      =============== MyTest.java source end =================
      =============== MyTest.sh begin ========================
      #!/bin/bash
      export JDK='/net/linux-15/export/home/java/jdk1.5.0/linux'
      # Generating info about operating system
      uname -a
      # Source compilation
      $JDK/bin/javac MyTest.java
      # Test running
      $JDK/bin/java -showversion MyTest
      =============== MyTest.sh end ==========================
      =============== MyTest output begin ====================
      Linux linux-11 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
      GNU/Linux
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b30)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b30, mixed mode)

      Mixer is: com.sun.media.sound.HeadspaceMixer@f9f9d8
      Mixer is: com.sun.media.sound.SimpleInputDevice@112f614
      Trying to get:interface TargetDataLine
      Unexcpected IllegalArgumentException
      raised:java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine
      java.lang.IllegalArgumentException: Line unsupported: interface
      TargetDataLine
              at com.sun.media.sound.SimpleInputDevice.getLine(SimpleInputDevice.java:160)
              at MyTest.main(MyTest.java:15)
      =============== MyTest output end ======================
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: