On Wed, 26 Feb 2025 22:26:48 GMT, Alexander Zuev <kiz...@openjdk.org> wrote:

> - Check that the calculated audio data size does not exceed available heap 
> memory before committing to the rendering
> - Add a test case

test/jdk/javax/sound/midi/BulkSoundBank/BulkSoundBank.java line 52:

> 50:         }
> 51:         throw new RuntimeException("Test should throw 
> InvalidMidiDataException but it did not.");
> 52:     }

ByteArrayInputStream can be initialized within try-with resources block.

Suggestion:

        try (ByteArrayInputStream bis = new ByteArrayInputStream(midi)) {
            MidiSystem.getSoundbank(bis);
            throw new RuntimeException("Test should throw 
InvalidMidiDataException" 
                                       + " but it did not.");
        } catch (InvalidMidiDataException imda) {
            System.out.println("Caught InvalidMidiDataException as expected");
        }
    }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23814#discussion_r1975873774

Reply via email to