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: 4955856
Votes 0
Synopsis Sequencer.setLoopStartPoint(int) does not throw expected IAE
Category java:classes_sound
Reported Against tiger-beta
Release Fixed 1.5(tiger-b30)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 4964303
Submit Date 18-NOV-2003
Description



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">
  xxxxx@xxxxx   2003-11-21
Work Around
N/A
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.
  xxxxx@xxxxx   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.
  xxxxx@xxxxx   2003-11-24
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang