mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
put inputstream in try body so it can be autoclosed
This commit is contained in:
parent
0528555075
commit
3f47d5a253
1 changed files with 1 additions and 6 deletions
|
@ -140,13 +140,8 @@ public final class ImageHelper {
|
|||
* @return
|
||||
*/
|
||||
public static Image getImageFromResources(String path) {
|
||||
InputStream stream;
|
||||
stream = UI.class.getResourceAsStream(path);
|
||||
if (stream == null) {
|
||||
throw new IllegalArgumentException("Couldn't find image in resources: " + path);
|
||||
}
|
||||
|
||||
try {
|
||||
try(InputStream stream = UI.class.getResourceAsStream(path)) {
|
||||
ImageIO.setUseCache(false);
|
||||
BufferedImage image = ImageIO.read(stream);
|
||||
return image;
|
||||
|
|
Loading…
Reference in a new issue