JDK-4955856 : Sequencer.setLoopStartPoint(int) does not throw expected IAE
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2003-11-18
  • Updated: 2003-11-24
  • Resolved: 2003-11-24
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 b30Fixed
Related Reports
Relates :  
Description
Name: izR10247			Date: 11/18/2003



Current J2SE 1.5 b28 spec states following:
"
SetLoopEndPoint

public void setLoopEndPoint(long tick)
...
Throws:
    IllegalArgumentException - if the requested loop point cannot be set, 
usually because it falls outside the sequence's duration or because the 
ending point is before the starting point".

However current implementation of MidiSystem.getLoopEndPoint() does not
generated expected IllegalArgumentException. This bug causes failure of 
new JCK test:

api/javax_sound/midi/Sequencer/index.html#Loop[Loop003]

To reproduce this bug please run test 'MyTest' using  script 'MyTest.sh' below:

=============== MyTest.java source begin ===============
import javax.sound.midi.*;
import javax.sound.sampled.AudioPermission;

public class MyTest {

    public static void main(String argv[]) {

        Sequencer seq = null;
        MidiDevice.Info[] infos;
        try {
            infos = MidiSystem.getMidiDeviceInfo();
            for(int i=0;i<infos.length;i++) {
                if(MidiSystem.getMidiDevice(infos[i]) instanceof Sequencer) {
                    seq=(Sequencer)MidiSystem.getMidiDevice(infos[i]);
                }
            }
            seq.open();
            System.out.println("Revelead sequencer: " + seq.getClass().getName());
            seq.setLoopEndPoint(1);
            try{
                seq.setLoopStartPoint(2);
                System.out.println("Expected IAE does not generated!");
            } catch (IllegalArgumentException iae) {
                System.out.println("Expected IAE:" + iae);
            }
        } catch (MidiUnavailableException mue) {
            mue.printStackTrace();
            System.out.println("MidiUnavailableException was thrown: ");
        }
    System.exit(0);
    }
}
=============== MyTest.java source end =================
=============== MyTest.sh begin ========================
#!/bin/bash
export JDK='/net/linux-15/export/home/java/jdk1.5.0/sparc'
# 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 ====================
SunOS novo48 5.9 Generic_112233-07 sun4u sparc SUNW,Ultra-60
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b28)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)

Revelead sequencer: com.sun.media.sound.RealTimeSequencer
Expected IAE does not generated!
=============== MyTest output end ======================
======================================================================</TEXTAREA>
		      </td>
                    </tr>
                    <TR>
                      <TD colspan="2" bgcolor="#BFBFBF"> </td>
                    </tr>

<a name="comments"></a>
                    <!-- COMMENTS -->
                    <TR>
                      <TD bgcolor="#BFBFBF" align="left" valign="bottom" height="24"> 
		        <img src="/bugz/images/dot.gif" width="10">Comments
		      </td>
                      <TD bgcolor="#BFBFBF" align="left" valign="bottom" height="24"> 
			<!-- BEGIN:TBR Mohan
 			<A href="javascript:doDateStampSubmit(document.editbug_general, 'comments');"><font size="-1">[ Date Stamp ]</font></A> 
			<img src="/bugz/images/dot.gif" width="18">
			END:TBR -->
			<A href="javascript:doFullPageSubmit(document.editbug_general, 'comments');"><font size="-1">[ Full Page ]</font></a>
		        <img src="/bugz/images/dot.gif" width="22">
		        <FONT size="-1" color="darkblue">---  Enter SUN Proprietary data here  ---</font>
	              </td>
                    </tr>

                    <TR>
                      <TD bgcolor="#BFBFBF" colspan="2" nowrap align="left">
			<img src="/bugz/images/dot.gif" width="5">
                        <TEXTAREA rows="6" cols="95" wrap="virtual" name="comments" align="left" bgcolor="white">
###@###.### 2003-11-21

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

EVALUATION It is probably arguable what should happen when setting the loop point on a synthesizer whose sequence is not set. Currently, the loop points are cached. It seems, however, that this does not seem to be the right thing. A fix is easy and riskless. ###@###.### 2003-11-21 An unrelated note: the System.exit(0) at the end of the test case is not necessary (anymore). However, the sequencer instance should be closed. Then the VM exits normally after completion of the main() method. ###@###.### 2003-11-24
24-11-2003