United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4964288 Unexpected IAE raised while getting TargetDataLine
4964288 : Unexpected IAE raised while getting TargetDataLine

Details
Type:
Bug
Submit Date:
2003-12-05
Status:
Resolved
Updated Date:
2004-03-19
Project Name:
JDK
Resolved Date:
2004-03-19
Component:
client-libs
OS:
linux
Sub-Component:
javax.sound
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0

Related Reports
Relates:

Sub Tasks

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


                                     
2004-06-14
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
                                     
2004-06-11
PUBLIC COMMENTS

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



Hardware and Software, Engineered to Work Together