aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2018-02-26 20:52:16 +0100
committersteckbrief <steckbrief@chefmail.de>2018-02-26 20:52:16 +0100
commit010eb44ad971ad9e77b555179d70b6e43d1dec80 (patch)
tree37cb5ed599b1843f5a4090b5c1777c8f4da966a0
parent1b07917a2684d58cdb832fac84dafec1f9088486 (diff)
fixes FS#257 - Fix policy 31 violation
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java
index eee18cc9..a741dfbd 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java
@@ -350,12 +350,14 @@ public final class ImageUtil {
public static int calcSampleSize(Uri image, int size) throws FileNotFoundException {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
- Bitmap bmp = BitmapFactory.decodeStream(StreamUtil.openInputStreamFromContentResolver(image), null, options);
+ InputStream bmpInputStream = StreamUtil.openInputStreamFromContentResolver(image);
+ Bitmap bmp = BitmapFactory.decodeStream(bmpInputStream, null, options);
int height = options.outHeight;
int width = options.outWidth;
if (null != bmp) {
bmp.recycle();
}
+ StreamUtil.close(bmpInputStream);
return calcSampleSize(width, height, size);
}