JDK-4934262 : JCK1.5-runtime api/javax_sound/midi/Receiver/index.html#Receiver fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2003-10-08
  • Updated: 2003-10-13
  • Resolved: 2003-10-13
Related Reports
Duplicate :  
Relates :  
Description

Name: iaR10016			Date: 10/08/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b22
                  (the test fails with previous JDK builds because of the bug 4616517)
JCK            : JCK1.5-runtime (b05)
Platform[s]    : RedHat Linux 9.0 (GNOME1), Solaris 8 (sparc) (CDE), Suse Linux 8.2 (GNOME2)
                  (not reproducible on Windows)
switch/Mode    : default
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Falling test[s]: api/javax_sound/midi/Receiver/index.html#Receiver [Receiver001, Receiver003, Receiver004]

JCK1.5-runtime api/javax_sound/midi/Receiver/index.html#Receiver test fails with JDK1.5.0-b22.

Java TM 2 Platform Std. Ed. v1.5.0 API Specification reads about MidiSystem.getReceiver() method:
...
public static Receiver getReceiver()
                             throws MidiUnavailableException

Obtains a MIDI receiver from an external MIDI port or other default source.

If the system property javax.sound.midi.Receiver is defined or it is defined in the file
"sound.properties", it is used to identify the device that provides the default receiver.
For details, refer to the class description.
Returns:
    the default MIDI receiver
Throws:
    MidiUnavailableException - if the default receiver is not available due to resource restrictions
...

However, this method unexpectedly throws java.lang.IllegalArgumentException if default receiver
is not specified. It happens both on systems which can play midi and on systems which can not.

The following test example demonstrates the bug:

--------- test.java ---------
import javax.sound.midi.*;

public class test {
    public static void main(String[] args) {
     System.out.println("Default is " + System.getProperty("javax.sound.midi.Receiver"));
     try {
        Receiver r = MidiSystem.getReceiver();
        System.out.println(r);
       }
     catch (javax.sound.midi.MidiUnavailableException e) {System.out.println ("OK");}
      }
}
-----------------------------

Sample output is:

...
bugs/4616517> /net/linux-15/export/home/java/jdk1.5.0/linux/bin/java -showversion 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)

Default is null
Exception in thread "main" java.lang.IllegalArgumentException: Requested device not installed
     at javax.sound.midi.MidiSystem.getDefaultDevice(MidiSystem.java:926)
     at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:223)
     at test.main(test.java:7)
bugs/4616517>
...

Please, note that javax.sound.midi.Receiver system property is not defined in the
<JRE>/lib/sound.properties file by default.

Also please note that JDK implementation and MidiSystem class API Specification were changed in
JDK1.5.0-b22 and this test example does not throw any exception with JDK1.5.0-b21.
Sample output is:

...
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b21)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b21, mixed mode)

Default is null
com.sun.media.sound.MixerSequencer$SequencerReceiver@9931f5
bugs/4616517>
...

Test source location:
=====================
/java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-15/tests/api/javax_sound/midi/Receiver/ReceiverTests.java

jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b22/jck15/linux/redhat9.0_gnome_smp_client_dsa_linux-22/workDir/api/javax_sound/midi/Receiver/index_Receiver.jtr

How to reproduce:
=================
Run the following script (you may need to change its variables):
--- script start ---
#!/bin/bash
#KOORI_ONESTOP is your path to koori.sfbay/onestop (/net/koori/onestop, /java/re)
KOORI_ONESTOP="/java/re"
#JCK="/net/linux-15/export/home/java/jck1.5/JCK-runtime-15"
JCK="$KOORI_ONESTOP/jck/1.5/promoted/beta/b04/binaries/JCK-runtime-15"
#JDK="/net/linux-15/export/home/java/jdk1.5.0/linux"
JDK="$KOORI_ONESTOP/jdk/1.5.0/promoted/all/b22/binaries/linux-i586"
export CLASSPATH="$JCK/classes:$JCK/lib/javatest.jar"
$JDK/bin/java -showversion javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests                -TestCaseID Receiver001 Receiver003 Receiver004
--- script end ---

Test output:
============
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)

java.lang.IllegalArgumentException: Requested device not installed
     at javax.sound.midi.MidiSystem.getDefaultDevice(MidiSystem.java:926)
     at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:223)
     at javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests.Receiver001(ReceiverTests.java:78)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
     at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
     at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
     at javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests.main(ReceiverTests.java:38)
Receiver001: Failed. Test case throws exception: java.lang.IllegalArgumentException: Requested device not installed
java.lang.IllegalArgumentException: Requested device not installed
     at javax.sound.midi.MidiSystem.getDefaultDevice(MidiSystem.java:926)
     at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:223)
     at javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests.Receiver003(ReceiverTests.java:157)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
     at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
     at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
     at javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests.main(ReceiverTests.java:38)
Receiver003: Failed. Test case throws exception: java.lang.IllegalArgumentException: Requested device not installed
java.lang.IllegalArgumentException: Requested device not installed
     at javax.sound.midi.MidiSystem.getDefaultDevice(MidiSystem.java:926)
     at javax.sound.midi.MidiSystem.getReceiver(MidiSystem.java:223)
     at javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests.Receiver004(ReceiverTests.java:190)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
     at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
     at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
     at javasoft.sqe.tests.api.javax.sound.midi.Receiver.ReceiverTests.main(ReceiverTests.java:38)
Receiver004: Failed. Test case throws exception: java.lang.IllegalArgumentException: Requested device not installed
STATUS:Failed.test cases: 3; all failed; first test case failure: Receiver001

Specific machine info:
======================
Hostname: linux-1
OS: Solaris 8 (sparc) (CDE)
Hostname: linux-22
OS: RedHat Linux 9.0 (GNOME2)
Hostname: linux-12
OS: Suse Linux 8.1 (GNOME2)

======================================================================

Comments
EVALUATION ###@###.### 2003-10-12 This is a duplicate of 4932838: REGRESSION: undeclared IAE in MidiSystem.getReceiver() which should be closed because: 4912894 SPEC: MidiSystem.getSequencer() etc. should declare IAE But since this is a JCK failure, I ask the submitter how to proceed.
11-06-2004

PUBLIC COMMENTS JCK1.5-runtime api/javax_sound/midi/Receiver/index.html#Receiver fails
10-06-2004