Skip to content

Commit

Permalink
squash a handled NPE and fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Dec 26, 2022
1 parent 218ace2 commit a8620b6
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -25,7 +25,7 @@
/**
* Helps to track statements and resultsets which need being closed.
* This class is not threadsafe.
*
* <p>
* Note regarding performance: we had evidence that allocating Iterators
* to implement the cleanup on each element recursively was the dominant
* resource cost, so we decided using "forEach" and lambdas in this case.
Expand Down Expand Up @@ -78,7 +78,6 @@ public boolean hasRegisteredResources() {
}

@Override
@SuppressWarnings("unchecked")
public void register(Statement statement, boolean cancelable) {
log.tracef( "Registering statement [%s]", statement );

Expand Down Expand Up @@ -166,12 +165,13 @@ private static void releaseXref(final Statement s, final HashMap<ResultSet, Obje
close( s );
}

@SuppressWarnings("unchecked")
private static void close(final ResultSet resultSet) {
log.tracef( "Closing result set [%s]", resultSet );

try {
resultSet.close();
if ( resultSet != null ) {
resultSet.close();
}
}
catch (SQLException e) {
log.debugf( "Unable to release JDBC result set [%s]", e.getMessage() );
Expand Down

0 comments on commit a8620b6

Please sign in to comment.