Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CONJ-237] correction on closing an already closed prepareStatement
  • Loading branch information
rusher committed Dec 26, 2015
1 parent 3da9340 commit 4a949d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -404,7 +404,7 @@ public void close() throws SQLException {
// immediately garbage collected
cachedResultSets.clear();

if (protocol.isConnected()) {
if (protocol != null && protocol.isConnected()) {
try {
protocol.releasePrepareStatement(sql, prepareResult.statementId);
} catch (QueryException e) {
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/org/mariadb/jdbc/PreparedStatementTest.java
Expand Up @@ -32,6 +32,14 @@ public static void initClass() throws SQLException {
"ENGINE=InnoDB DEFAULT CHARSET=utf8");
}

@Test
public void testClosingError() throws Exception {
PreparedStatement preparedStatement = sharedConnection.prepareStatement("SELECT ?");
preparedStatement.close();
preparedStatement.close();

}

/**
* Conj-90.
*
Expand Down

0 comments on commit 4a949d2

Please sign in to comment.