Skip to content

Commit

Permalink
NIFI-13397 PutDatabaseRecord: Make retry check more inclusive to test
Browse files Browse the repository at this point in the history
getCause() == SQLTransientException for all exception classes
  • Loading branch information
jrsteinebrey committed Jun 13, 2024
1 parent a8e8b6a commit ac76a1f
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ac76a1f

Please sign in to comment.