-
Notifications
You must be signed in to change notification settings - Fork 860
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: PgDatabaseMetaData: close statement in finally
closes #516
- Loading branch information
Showing
2 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
pgjdbc/src/main/java/org/postgresql/util/JdbcBlackHole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.postgresql.util; | ||
|
||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
|
||
public class JdbcBlackHole { | ||
public static void close(Connection con) { | ||
try { | ||
if (con != null) { | ||
con.close(); | ||
} | ||
} catch (SQLException e) { | ||
/* ignore for now */ | ||
} | ||
} | ||
|
||
public static void close(Statement s) { | ||
try { | ||
if (s != null) { | ||
s.close(); | ||
} | ||
} catch (SQLException e) { | ||
/* ignore for now */ | ||
} | ||
} | ||
|
||
public static void close(ResultSet rs) { | ||
try { | ||
if (rs != null) { | ||
rs.close(); | ||
} | ||
} catch (SQLException e) { | ||
/* ignore for now */ | ||
} | ||
} | ||
} |