From 89aa57826a2f4fdebd0ff069c1b9cdf9a89b5805 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 12 Aug 2018 22:40:07 +0200 Subject: [PATCH] Fix undocumented exception in SaveImageAwt --- src/be/nikiroo/utils/ui/ImageUtilsAwt.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/be/nikiroo/utils/ui/ImageUtilsAwt.java b/src/be/nikiroo/utils/ui/ImageUtilsAwt.java index 0c69dc4..3acbe55 100644 --- a/src/be/nikiroo/utils/ui/ImageUtilsAwt.java +++ b/src/be/nikiroo/utils/ui/ImageUtilsAwt.java @@ -36,7 +36,14 @@ public class ImageUtilsAwt extends ImageUtils { // Some formats are not reliable // Second chance: PNG if (!ok && !format.equals("png")) { - ok = ImageIO.write(image, "png", target); + try { + ok = ImageIO.write(image, "png", target); + } catch (IllegalArgumentException e) { + throw e; + } catch (Exception e) { + throw new IOException("Undocumented exception occured, " + + "converting to IOException", e); + } } if (!ok) { -- 2.27.0