johnjcasey commented on code in PR #23757:
URL: https://github.com/apache/beam/pull/23757#discussion_r1008180274
##########
sdks/java/io/common/src/test/java/org/apache/beam/sdk/io/common/DatabaseTestHelper.java:
##########
@@ -100,13 +100,21 @@ public static void createTable(
.withMaxRetries(4)
.backoff();
while (true) {
- try (Connection connection = dataSource.getConnection()) {
+ //This is not implemented as try-with-resources because it appears that
try-with-resources is
+ //not correctly catching the PSQLException thrown by
dataSource.getConnection()
+ Connection connection = null;
+ try {
+ connection = dataSource.getConnection();
try (Statement statement = connection.createStatement()) {
statement.execute(String.format("create table %s (%s)", tableName,
fieldsList));
return;
}
} catch (SQLException e) {
exception = e;
+ } finally {
+ if (connection!=null){
+ connection.close();
Review Comment:
it looks like it is happening in .getConnection based on the stacktrace
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]