mirror of https://github.com/apache/nifi.git
NIFI-11900 Catch RuntimeException in ResizeImage failures
This closes #7558 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
80e71068be
commit
49a350a765
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue