This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 49a350a765 NIFI-11900 Catch RuntimeException in ResizeImage failures
49a350a765 is described below

commit 49a350a765e0185ac2dd3deed5a92f58cd0534e3
Author: Mike Thomsen <[email protected]>
AuthorDate: Wed Aug 2 09:21:08 2023 -0400

    NIFI-11900 Catch RuntimeException in ResizeImage failures
    
    This closes #7558
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../java/org/apache/nifi/processors/image/ResizeImage.java     | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-media-bundle/nifi-media-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
 
b/nifi-nar-bundles/nifi-media-bundle/nifi-media-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
index 7be885712a..240e8e2a4e 100644
--- 
a/nifi-nar-bundles/nifi-media-bundle/nifi-media-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
+++ 
b/nifi-nar-bundles/nifi-media-bundle/nifi-media-processors/src/main/java/org/apache/nifi/processors/image/ResizeImage.java
@@ -169,8 +169,8 @@ public class ResizeImage extends AbstractProcessor {
                 reader.setInput(iis, true);
                 image = reader.read(0);
             }
-        } catch (final IOException | IllegalArgumentException | 
ProcessException ex) {
-            getLogger().error("Failed to read {} due to {}", new Object[] { 
flowFile, ex });
+        } catch (final IOException | RuntimeException ex) {
+            getLogger().error("Failed to read {} due to {}", flowFile, ex);
             session.transfer(flowFile, REL_FAILURE);
             return;
         }
@@ -182,14 +182,14 @@ public class ResizeImage extends AbstractProcessor {
             width = 
context.getProperty(IMAGE_WIDTH).evaluateAttributeExpressions(flowFile).asInteger();
             height = 
context.getProperty(IMAGE_HEIGHT).evaluateAttributeExpressions(flowFile).asInteger();
 
-            if(keepRatio) {
+            if (keepRatio) {
                 Dimension finalDimension = 
getScaledDimension(image.getWidth(), image.getHeight(), width, height);
                 width = finalDimension.width;
                 height = finalDimension.height;
             }
 
         } catch (final NumberFormatException nfe) {
-            getLogger().error("Failed to resize {} due to {}", new Object[] { 
flowFile, nfe });
+            getLogger().error("Failed to resize {} due to {}", flowFile, nfe);
             session.transfer(flowFile, REL_FAILURE);
             return;
         }
@@ -217,7 +217,7 @@ public class ResizeImage extends AbstractProcessor {
 
             ImageIO.write(scaledBufferedImg, formatName, out);
         } catch (final IOException | NegativeArraySizeException ex) {
-            getLogger().error("Failed to write {} due to {}", new Object[] { 
flowFile, ex });
+            getLogger().error("Failed to write {} due to {}", flowFile, ex);
             session.transfer(flowFile, REL_FAILURE);
             return;
         }

Reply via email to