JDK-4964288 : Unexpected IAE raised while getting TargetDataLine
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2003-12-05
  • Updated: 2004-03-19
  • Resolved: 2004-03-19
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 b44Fixed
Related Reports
Relates :  
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 ======================
======================================================================

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

EVALUATION Problem in old implementation, should still get fixed for Tiger. ###@###.### 2003-12-15 Fixed by never returning a SimpleInputDevice when there is no read access to the audio device. This is not really correct, since the device is there, it is just not accessible. But since this device would not provide any formats, it would be unusable anyway. So not returning any device then is better. ###@###.### 2004-03-04 To reproduce the bug, do the following: 1) stop alsa 2) uninstall ALSA libraries 3) run the test program and verify that the OSS implementation is used (Java Sound Audio Engine, and SimpleInputDevice) 4) as root, make the audio device inaccessible: chmod a-rw /dev/ds* /dev/mixe* /dev/sequence* /dev/mid* 5) Now the test program should fail
11-06-2004

PUBLIC COMMENTS Fixed in tiger build 44, beta2, by disabling devices that are not accessible.
10-06-2004