Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4964288
Votes 0
Synopsis Unexpected IAE raised while getting TargetDataLine
Category java:classes_sound
Reported Against tiger-beta
Release Fixed 1.5(tiger-b44)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs
Submit Date 05-DEC-2003
Description
Fixed in tiger build 44, beta2, by disabling devices that are not accessible.





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:  xxxxx@xxxxx 
Mixer is:  xxxxx@xxxxx 
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 ======================
======================================================================
Work Around
N/A
Evaluation
Problem in old implementation, should still get fixed for Tiger.
 xxxxx@xxxxx  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.
 xxxxx@xxxxx  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
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang