Skip to content

Commit

Permalink
Merge pull request #66 from smartikscomtr/master
Browse files Browse the repository at this point in the history
Close statements
  • Loading branch information
dnwick authored Feb 24, 2021
2 parents 9a3c4f9 + da44b88 commit 3859067
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void poll() {

public String getLastReadPollingColumnValue(Connection connection) {
String selectQuery;
PreparedStatement statement;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
if (lastReadPollingColumnValue == null) {
Expand All @@ -126,7 +126,7 @@ public String getLastReadPollingColumnValue(Connection connection) {
} catch (SQLException ex) {
throw new CDCPollingModeException(buildError("Error in polling for changes on %s.", tableName), ex);
} finally {
CDCPollingUtil.cleanupConnection(resultSet, null, null);
CDCPollingUtil.cleanupConnection(resultSet, statement, null);
}
}

Expand All @@ -135,7 +135,7 @@ public boolean printEvent(Connection connection) {
ResultSetMetaData metadata;
Map<String, Object> detailsMap;
String selectQuery;
PreparedStatement statement;
PreparedStatement statement = null;
boolean isError = false;
try {
selectQuery = getSelectQuery("*", "WHERE " + pollingColumn + " > ?");
Expand All @@ -161,7 +161,7 @@ public boolean printEvent(Connection connection) {
}
log.error(buildError("Error occurred while processing records in table %s.", tableName), ex);
} finally {
CDCPollingUtil.cleanupConnection(resultSet, null, null);
CDCPollingUtil.cleanupConnection(resultSet, statement, null);
return isError;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void poll() {
}
log.error(buildError("Error occurred while processing records in table %s.", tableName), e);
} finally {
CDCPollingUtil.cleanupConnection(resultSet, null, null);
CDCPollingUtil.cleanupConnection(resultSet, statement, null);
}
try {
if (metrics != null) {
Expand Down

0 comments on commit 3859067

Please sign in to comment.