This is an automated email from the ASF dual-hosted git repository. exceptionfactory pushed a commit to branch support/nifi-1.x in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/support/nifi-1.x by this push: new a019102558 NIFI-11900 Catch RuntimeException in ResizeImage failures a019102558 is described below commit a0191025585882eaaf721d8eab51466a576dc595 Author: Mike Thomsen <mthom...@apache.org> AuthorDate: Wed Aug 2 09:21:08 2023 -0400 NIFI-11900 Catch RuntimeException in ResizeImage failures This closes #7558 Signed-off-by: David Handermann <exceptionfact...@apache.org> (cherry picked from commit 49a350a765e0185ac2dd3deed5a92f58cd0534e3) --- .../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 8b21318266..ca860b4758 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 @@ -171,8 +171,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; } @@ -184,14 +184,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; } @@ -219,7 +219,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; }