From 91392e2b742b7da5826c13797e610cf0acc36753 Mon Sep 17 00:00:00 2001 From: Hashir Rajah Date: Tue, 24 Sep 2024 15:02:33 +0400 Subject: [PATCH 1/7] Add jackson --- plugin.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin.xml b/plugin.xml index f2f8368..98a16bb 100755 --- a/plugin.xml +++ b/plugin.xml @@ -12,6 +12,9 @@ + + + From ab0681535a2cca47761e4ce67c2d199ee32223c7 Mon Sep 17 00:00:00 2001 From: Hashir Rajah Date: Tue, 24 Sep 2024 15:02:42 +0400 Subject: [PATCH 2/7] Import jackson --- src/android/Thumbnails.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/android/Thumbnails.java b/src/android/Thumbnails.java index 4ba04a1..8532255 100755 --- a/src/android/Thumbnails.java +++ b/src/android/Thumbnails.java @@ -16,10 +16,12 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; public class Thumbnails { - public static void thumbnail(Options thumbnailOptions) throws IOException { + public static void thumbnail(Options thumbnailOptions) throws Exception { long begin = System.currentTimeMillis(); Bitmap bitmap = thumbnailSmallImage(thumbnailOptions); @@ -37,7 +39,7 @@ public static void thumbnail(Options thumbnailOptions) throws IOException { bitmap = null; } - private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws IOException { + private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws Exception { BitmapFactory.Options options = calculateImageSize(thumbnailOptions.sourcePath); options.inJustDecodeBounds = false; From 6b2eedf0fcb9e36f10b7dd4a0108a34ba99f85a2 Mon Sep 17 00:00:00 2001 From: Hashir Rajah Date: Tue, 24 Sep 2024 15:04:42 +0400 Subject: [PATCH 3/7] Add null check --- src/android/Thumbnails.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/android/Thumbnails.java b/src/android/Thumbnails.java index 8532255..503bb06 100755 --- a/src/android/Thumbnails.java +++ b/src/android/Thumbnails.java @@ -45,6 +45,12 @@ private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws Excep options.inJustDecodeBounds = false; Bitmap bitmap = BitmapFactory.decodeFile(thumbnailOptions.sourcePath, options); + if (bitmap == null) { + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String optionsJSON = ow.writeValueAsString(options); + throw new Exception("Could not decode file into bitmap object { sourcePath: " + thumbnailOptions.sourcePath + " options: " + optionsJSON + " }"); + } + long begin = System.currentTimeMillis(); int oWidth = bitmap.getWidth(); int oHeight = bitmap.getHeight(); From 5cb44dc97c3443b34b4a90e50396f08301e8b903 Mon Sep 17 00:00:00 2001 From: Hashir Rajah Date: Tue, 24 Sep 2024 16:10:19 +0400 Subject: [PATCH 4/7] Latest jackson version --- plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.xml b/plugin.xml index 98a16bb..1134055 100755 --- a/plugin.xml +++ b/plugin.xml @@ -12,8 +12,8 @@ - - + + From 060c2c42aeb30aa3aa86672db5060b5e7937ce82 Mon Sep 17 00:00:00 2001 From: Hashir Rajah Date: Tue, 24 Sep 2024 16:19:11 +0400 Subject: [PATCH 5/7] Remove jackson for test --- plugin.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugin.xml b/plugin.xml index 1134055..f637e5c 100755 --- a/plugin.xml +++ b/plugin.xml @@ -12,8 +12,6 @@ - - From 2d458ee3dea9af2997533aab30e96d5e7683d6c1 Mon Sep 17 00:00:00 2001 From: Hashir Rajah Date: Tue, 24 Sep 2024 16:24:38 +0400 Subject: [PATCH 6/7] Add jackson --- plugin.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin.xml b/plugin.xml index f637e5c..cb9dff2 100755 --- a/plugin.xml +++ b/plugin.xml @@ -12,6 +12,8 @@ + + From 2b8ebb0319462abe305aa1a8631875bf590b528f Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Wed, 25 Sep 2024 10:18:33 +0400 Subject: [PATCH 7/7] testing --- plugin.xml | 2 -- src/android/Thumbnails.java | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/plugin.xml b/plugin.xml index cb9dff2..f637e5c 100755 --- a/plugin.xml +++ b/plugin.xml @@ -12,8 +12,6 @@ - - diff --git a/src/android/Thumbnails.java b/src/android/Thumbnails.java index 503bb06..cb65cc4 100755 --- a/src/android/Thumbnails.java +++ b/src/android/Thumbnails.java @@ -16,8 +16,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; public class Thumbnails { @@ -46,9 +44,7 @@ private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws Excep Bitmap bitmap = BitmapFactory.decodeFile(thumbnailOptions.sourcePath, options); if (bitmap == null) { - ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); - String optionsJSON = ow.writeValueAsString(options); - throw new Exception("Could not decode file into bitmap object { sourcePath: " + thumbnailOptions.sourcePath + " options: " + optionsJSON + " }"); + throw new Exception("Could not decode file into bitmap object { sourcePath: " + thumbnailOptions.sourcePath + " options: }"); } long begin = System.currentTimeMillis();