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.