X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FImageUtilsAwt.java;h=148f8f57451141805c508de08e8254b0f3e2d407;hb=354666447f9c71a7fb2e15d9c50ed62ce27d7108;hp=0c69dc4482938ae02608be704167e23a8add13e0;hpb=e704a41477b85b6bb76dff4181df132176aec112;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/ui/ImageUtilsAwt.java b/src/be/nikiroo/utils/ui/ImageUtilsAwt.java index 0c69dc4..148f8f5 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) { @@ -73,7 +80,15 @@ public class ImageUtilsAwt extends ImageUtils { } in.reset(); - BufferedImage image = ImageIO.read(in); + BufferedImage image; + try { + image = ImageIO.read(in); + } catch (IllegalArgumentException e) { + throw e; + } catch (Exception e) { + throw new IOException("Undocumented exception occured, " + + "converting to IOException", e); + } if (image == null) { throw new IOException("Failed to convert input to image");