From dffa31ec345c071dc21b7245b4e75ed629b04e85 Mon Sep 17 00:00:00 2001 From: Yuriy Kuchynskyy Date: Thu, 20 Jul 2017 19:05:09 -0700 Subject: [PATCH 1/2] move up to version 1.0.7.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 75de0c0..1b4c049 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,6 @@ ext { sdk = 25 buildTools = "25.0.2" minSdk = 10 - libraryVersion = "1.0.7" + libraryVersion = "1.0.7.1" supportVersion = "25.0.0" } From 34949eccad2a48fe01cfc279655f3748de21d93a Mon Sep 17 00:00:00 2001 From: Yuriy Kuchynskyy Date: Thu, 20 Jul 2017 19:07:44 -0700 Subject: [PATCH 2/2] image can be closed, adding an extra catch --- .../camerafragment/internal/utils/ImageSaver.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/utils/ImageSaver.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/utils/ImageSaver.java index 7b21849..df7e818 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/utils/ImageSaver.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/utils/ImageSaver.java @@ -36,17 +36,20 @@ public class ImageSaver implements Runnable { @TargetApi(Build.VERSION_CODES.KITKAT) @Override public void run() { - ByteBuffer buffer = image.getPlanes()[0].getBuffer(); - byte[] bytes = new byte[buffer.remaining()]; - buffer.get(bytes); FileOutputStream output = null; try { + ByteBuffer buffer = image.getPlanes()[0].getBuffer(); + byte[] bytes = new byte[buffer.remaining()]; + buffer.get(bytes); output = new FileOutputStream(file); output.write(bytes); imageSaverCallback.onSuccessFinish(bytes); } catch (IOException ignore) { Log.e(TAG, "Can't save the image file."); imageSaverCallback.onError(); + } catch (IllegalStateException e) { + Log.e(TAG, "Can't read the image file.", e); + imageSaverCallback.onError(); } finally { image.close(); if (null != output) {