From: Niki Roo Date: Sun, 12 Aug 2018 20:40:07 +0000 (+0200) Subject: Fix undocumented exception in SaveImageAwt X-Git-Tag: nikiroo-utils-4.4.1~2 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=89aa57826a2f4fdebd0ff069c1b9cdf9a89b5805;p=nikiroo-utils.git Fix undocumented exception in SaveImageAwt --- 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) {