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

Synthesizer.unloadAllInstruments(Soundbank) does not throw IllegalArgumentException

XMLWordPrintable

      The specification on javax.sound.midi.Synthesizer.unloadAllInstruments(Soundbank) says:
      ------------------------------------------------------------------------------------------
      void unloadAllInstruments(Soundbank soundbank)
          . . .
          Throws:
              IllegalArgumentException - thrown if the soundbank is not supported.
      ------------------------------------------------------------------------------------------

      The following testcase checks this behavior:
      api/javax_sound/midi/Synthesizer/index.html#unload[unload001]

      Here is the excerpt of the meaningful part of the code:
      ------------------------------------------------------------------------------------------
              . . .
              try {
                  synth = MidiSystem.getSynthesizer();
                  synth.open();
                  sBank = new MySoundbank();

                  if (!synth.isSoundbankSupported(sBank)) {
                      synth.unloadAllInstruments(sBank);
                      failed = true;
                      log.println("IllegalArgumentException should be thrown for "
                              + "unsupported banks!");
                  }
              } catch (IllegalArgumentException ie) {
                  log.println("Soundbank is not compatible. OKAY");

              }
      ------------------------------------------------------------------------------------------

      And here is the output:

      IllegalArgumentException should be thrown for unsupported banks!
      unload001: Failed.

            darcy Joe Darcy
            ashusher Alexander Shusherov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: