JDK-4932835 : REGRESSION: IAE for supported line in AudioSystem.getLine()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2003-10-06
  • Updated: 2003-10-13
  • Resolved: 2003-10-13
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 b24Fixed
Related Reports
Relates :  
Description

Name: vtR10009			Date: 10/06/2003


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)

--------------------------------------------------------------------------
======================================================================

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

PUBLIC COMMENTS REGRESSION: IAE for supported line in AudioSystem.getLine()
10-06-2004

EVALUATION ###@###.### 2003-10-12 Fixed along with fix for 4921049.
12-10-2003