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.
5.0 b44Fixed
Related Reports
Relates :  

Name: izR10247			Date: 12/05/2003

Current J2SE 1.5 b30 spec states following:
Interface Mixer


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.

        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 

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:


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]);
                } catch (IllegalArgumentException iae) {
                    System.out.println("Unexpected IllegalArgumentException raised:" + iae);
                } catch (LineUnavailableException lue) {
                    System.out.println("Unexpected IllegalArgumentException raised:" + lue);
=============== MyTest.java source end =================
=============== MyTest.sh begin ========================
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 
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 
        at com.sun.media.sound.SimpleInputDevice.getLine(SimpleInputDevice.java:160)
        at MyTest.main(MyTest.java:15)
=============== MyTest output end ======================

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

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

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