ShimejiEE-cross-platform
ShimejiEE-cross-platform copied to clipboard
SoundLoader doesn't close the AudioInputStream
In the createClipFrom method in the SoundLoader class, the AudioInputStream is not closed by the end of the method. I'm not sure if this was done intentionally or accidentally, but this results in the sound file remaining open and accessed by the program. Putting it in a try-with-resources seems to fix the error that was popping up when attempting to compile (the error being that it kept failing to delete a temporary file, likely due to the test still accessing it), but I do not know if that may break the audio as I don't know how to trigger a sound effect to play in program. I have included two screenshots, one where the code is unmodified and my suggested correction. I have also included the error log that the unmodified code produces.
Error log produced by maven from tests: com.group_finity.mascot.sound.SoundLoaderTest.txt
Unmodified code that doesn't compile:
My suggested correction that does compile without errors: