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: 4932835
Votes 0
Synopsis REGRESSION: IAE for supported line in AudioSystem.getLine()
Category java:classes_sound
Reported Against hopper
Release Fixed 1.5(tiger-b24)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs 4921049
Submit Date 06-OCT-2003
Description
REGRESSION: IAE for supported line in AudioSystem.getLine()




AudioSystem.getLine(Line.info) method should not throw IllegalArgumentException
for lines that are supported by Java Sound framework.
This bug causes failure of JCK test:
  api/javax_sound/sampled/LineListener/index.html#LineListener

Note the test is passed by mantis (jdk1.4.2). So this is regression.   
To reproduce the bug run the following test with JDK build 1.5-beta-b22:
------------------------------- test.java --------------------------------
import javax.sound.sampled.*;
import javax.sound.midi.*;

public class test {

    static boolean isSoundAccessDenied = false;
    static {
        SecurityManager securityManager = System.getSecurityManager();
        if (securityManager != null) {
            try {
                securityManager.checkPermission(new AudioPermission("*"));
            } catch (SecurityException e) {
                isSoundAccessDenied = true;
            }
        }
    }

    static final int STATUS_PASSED = 0;
    static final int STATUS_FAILED = 2;
    static final int STATUS_TEMP = 95;
    static java.io.PrintStream log = System.err; 
    
    public static void main(String argv[]) { int testExitStatus = run(argv,
    System.out) + STATUS_TEMP; System.exit(testExitStatus); }

    public static int run(String argv[], java.io.PrintStream out) { String
        testCaseID = "LineListener2001";

        log.println("===== " + testCaseID + " =====");
    
        boolean failed = false;
        Line l = null;
    

    
        // get the default SourceDataLine
    
        DataLine.Info s_info = new DataLine.Info(SourceDataLine.class, null);
        Line.Info infos[] = AudioSystem.getSourceLineInfo( s_info );
    
        if( infos.length < 1 ) {
            log.println("Line.Info array == 0");
            return STATUS_PASSED;
        }
        try {
            l = AudioSystem.getLine(infos[0]);
        } catch(SecurityException lue) {
            log.println("SecurityException");
            return STATUS_PASSED;
        } catch (LineUnavailableException e1) {
            log.println("LUE");
            return STATUS_PASSED;
        } catch (IllegalArgumentException iae) {
            log.println("IllegalArgumentException should not be thrown " 
                     + "for supported line");
            iae.printStackTrace(log);
            return STATUS_FAILED;   
        } 
        out.println("Passed.");
        return STATUS_PASSED;
    }
    
}    // end of test class 
---------------------------Logs-------------------------------------------
novo101:tmp$ javac -d . test.java 
novo101:tmp$ java -showversion -cp . test
java version "1.4.2-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-rc-b25)
Java HotSpot(TM) Client VM (build 1.4.2-rc-b25, mixed mode)

===== LineListener2001 =====
Passed.
novo101:tmp$ $JDK15/bin/java -showversion -cp . test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b22)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b22, mixed mode)

===== LineListener2001 =====
IllegalArgumentException should not be thrown for supported line
java.lang.IllegalArgumentException: Line unsupported: interface SourceDataLine 
supporting 4 audio formats, and buffers of at least 32 bytes
        at com.sun.media.sound.HeadspaceMixer.getLine(HeadspaceMixer.java:241)
        at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:413)
        at test.run(test.java:47)
        at test.main(test.java:24)

--------------------------------------------------------------------------
======================================================================
Work Around
N/A
Evaluation
  xxxxx@xxxxx   2003-10-12
	Fixed along with fix for 4921049.
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang