This is an automated email from the ASF dual-hosted git repository. joewitt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 077e09cf3ea13d1b959791c297810cecfad823f5 Author: exceptionfactory <[email protected]> AuthorDate: Fri Jul 22 20:20:47 2022 -0500 NIFI-10269 This closes #6241. Upgraded H2 from 2.1.210 to 2.1.214 - Adjusted H2DatabaseUpdater to catch generalized SQLNonTransientException instead of H2 JdbcSQLNonTransientException Signed-off-by: Joe Witt <[email protected]> --- .../apache/nifi/h2/database/migration/H2DatabaseUpdater.java | 10 ++++++---- pom.xml | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java b/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java index 8cf07fee56..7a5109214b 100644 --- a/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java +++ b/nifi-h2/nifi-h2-database-migrator/src/main/java/org/apache/nifi/h2/database/migration/H2DatabaseUpdater.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.h2.database.migration; -import org.h2.jdbc.JdbcSQLNonTransientException; import org.h2.jdbcx.JdbcDataSource; import org.h2.mvstore.MVStoreException; import org.slf4j.Logger; @@ -28,6 +27,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Connection; import java.sql.SQLException; +import java.sql.SQLNonTransientException; import java.sql.Statement; public class H2DatabaseUpdater { @@ -48,16 +48,18 @@ public class H2DatabaseUpdater { migrationDataSource.setPassword(pass); try (Connection connection = migrationDataSource.getConnection()) { return; - } catch (JdbcSQLNonTransientException jsqlnte) { + } catch (SQLNonTransientException e) { // Migration/version issues will be caused by an MVStoreException - final Throwable exceptionCause = jsqlnte.getCause(); + final Throwable exceptionCause = e.getCause(); if (exceptionCause instanceof MVStoreException) { // Check for specific error message final String errorMessage = exceptionCause.getMessage(); if (!errorMessage.contains("The write format") && !errorMessage.contains("is smaller than the supported format")) { - throw jsqlnte; + throw e; } + } else { + throw e; } } catch (SQLException sqle) { throw new RuntimeException(String.format("H2 connection failed URL [%s] File [%s]", dbUrl, dbPathNoExtension), sqle); diff --git a/pom.xml b/pom.xml index af5d0d5ee5..d2c9fb9c83 100644 --- a/pom.xml +++ b/pom.xml @@ -138,7 +138,7 @@ <netty.4.version>4.1.79.Final</netty.4.version> <spring.version>5.3.22</spring.version> <spring.security.version>5.7.2</spring.security.version> - <h2.version>2.1.210</h2.version> + <h2.version>2.1.214</h2.version> <zookeeper.version>3.8.0</zookeeper.version> </properties> <dependencyManagement>
