Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4955856

Sequencer.setLoopStartPoint(int) does not throw expected IAE

XMLWordPrintable

    • b30
    • sparc
    • solaris_9

      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

            fbomerssunw Florian Bomers (Inactive)
            garysunw Gary Gary (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: