From ac76a1f70d9830614dd6187e0ff64d8ca0de17aa Mon Sep 17 00:00:00 2001 From: Jim Steinebrey Date: Thu, 13 Jun 2024 12:27:17 -0400 Subject: [PATCH] NIFI-13397 PutDatabaseRecord: Make retry check more inclusive to test getCause() == SQLTransientException for all exception classes --- .../apache/nifi/processors/standard/PutDatabaseRecord.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java index e0dbf5b38be2..0692f608c257 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java @@ -65,7 +65,6 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import java.sql.BatchUpdateException; import java.sql.Clob; import java.sql.Connection; import java.sql.DatabaseMetaData; @@ -585,8 +584,7 @@ private void routeOnException(final ProcessContext context, final ProcessSession // When an Exception is thrown, we want to route to 'retry' if we expect that attempting the same request again // might work. Otherwise, route to failure. SQLTransientException is a specific type that indicates that a retry may work. final Relationship relationship; - final Throwable toAnalyze = (e instanceof BatchUpdateException) ? e.getCause() : e; - if (toAnalyze instanceof SQLTransientException) { + if (e instanceof SQLTransientException || e.getCause() instanceof SQLTransientException) { relationship = REL_RETRY; flowFile = session.penalize(flowFile); } else {