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

Synthesizer.unloadInstruments(Soundbank,Patch[]) does not throw IllegalArgumentException

    XMLWordPrintable

Details

    Description

      The specification of javax.sound.midi.Synthesizer.unloadInstruments(Soundbank,Patch[]) says:
      ------------------------------------------------------------------------------------------
      void unloadInstruments(Soundbank soundbank,
                             Patch[] patchList)
          . . .
          Throws:
              IllegalArgumentException - thrown if the soundbank is not supported.
      ------------------------------------------------------------------------------------------

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

      Here is the excerpt of the meaningful part of the code:
      ------------------------------------------------------------------------------------------
              . . .

              try {
                  synth = MidiSystem.getSynthesizer();
                  synth.open();
                  sBank = new MySoundbank();

                  if (!synth.isSoundbankSupported(sBank)) {
                      instrs = sBank.getInstruments();
                      pList = new Patch[instrs.length];
                      for (int i = 0; i < instrs.length; i++) {
                          pList[i] = instrs[i].getPatch();
                      }
                      synth.unloadInstruments(sBank, pList);
                      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!
      unload006: Failed.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: