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

MIDI file parser breaks up on http connection

XMLWordPrintable

    • tiger
    • generic
    • generic



      Name: fb126949 Date: 08/22/2003


      I have an applet that plays a MIDI file.
      First I had a small MIDI file with 2 tracks, about 2kb. It ran fine in the
      applet, both file: protocol (locally) as http: protocol (remote).

      Then I tried to open a larger MIDI file, 5 tracks, 12Kb. I get an exception
      when I run the applet using a http url in MSIE6.0, Java Plug-in Version
      1.4.2:
      IO exception:

      java.io.EOFException
       at com.sun.media.sound.SMFParser.nextTrack(Unknown Source)
       at com.sun.media.sound.StandardMidiFileReader.getSequence(Unknown Source)
       at com.sun.media.sound.StandardMidiFileReader.getSequence(Unknown Source)

      ----

      Now I use
      result = MidiSystem.getSequence(new BufferedInputStream(url.openStream()));

      (The BufferedInputStream is necessary for the required mark and reset operations.)

      instead of
      result = MidiSystem.getSequence(url);

      This solved my problem.


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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: