fix ImageUtils/Android
authorNiki Roo <niki@nikiroo.be>
Sat, 18 May 2019 13:01:21 +0000 (15:01 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 18 May 2019 13:01:21 +0000 (15:01 +0200)
src/be/nikiroo/utils/ImageUtils.java
src/be/nikiroo/utils/android/ImageUtilsAndroid.java

index e95f73e4216d1cb8cc66db89227aca94fdd9c3f7..fb869294f2029bd1c0fd7f4a64680259ca4bc4b0 100644 (file)
@@ -211,7 +211,7 @@ public abstract class ImageUtils {
                                if (obj.check()) {
                                        return obj;
                                }
-                       } catch (Exception e) {
+                       } catch (Throwable e) {
                        }
                }
 
index d55e602cb89d247e6056caec1f49c9b484de7ed4..f50af005316c3fdc169aabfe8d11269171db8458 100644 (file)
@@ -10,8 +10,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.stream.Stream;
 
-import javax.imageio.ImageIO;
-
 import be.nikiroo.utils.Image;
 import be.nikiroo.utils.ImageUtils;
 import be.nikiroo.utils.StringUtils;
@@ -26,7 +24,7 @@ public class ImageUtilsAndroid extends ImageUtils {
        @Override
        protected boolean check() {
                // If we can get the class, it means we have access to it
-               Config.ALPHA_8;
+               Config c = Config.ALPHA_8;
                return true;
        }
 
@@ -82,10 +80,10 @@ public class ImageUtilsAndroid extends ImageUtils {
                                throw new IOException(
                                                "Failed to convert input to image, size was: " + ssize);
                        }
+
+                       return image;
                } finally {
                        stream.close();
                }
-               
-               return image;
        }
 }