Skip to content

Commit

Permalink
[CONJ-636] correcting possible NPE thrown in place of exception
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Aug 23, 2018
1 parent 25e1f5d commit 0fe442e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Expand Up @@ -58,7 +58,7 @@
<artifactId>mariadb-java-client</artifactId>
<packaging>jar</packaging>
<name>mariadb-java-client</name>
<version>2.2.6</version>
<version>2.2.7-SNAPSHOT</version>
<description>JDBC driver for MariaDB and MySQL</description>
<url>https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/</url>

Expand All @@ -71,8 +71,8 @@
<checkstyle.plugin.version>2.16</checkstyle.plugin.version>
<driver.version.major>2</driver.version.major>
<driver.version.minor>2</driver.version.minor>
<driver.version.patch>6</driver.version.patch>
<driver.version.qualifier></driver.version.qualifier>
<driver.version.patch>7</driver.version.patch>
<driver.version.qualifier>-SNAPSHOT</driver.version.qualifier>
</properties>

<licenses>
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/org/mariadb/jdbc/MariaDbPreparedStatementClient.java
Expand Up @@ -282,8 +282,11 @@ public int[] executeBatch() throws SQLException {
return results.getCmdInformation().getUpdateCounts();

} catch (SQLException sqle) {
if (results != null) results.commandEnd();
throw executeBatchExceptionEpilogue(sqle, results.getCmdInformation(), size);
if (results != null) {
results.commandEnd();
throw executeBatchExceptionEpilogue(sqle, results.getCmdInformation(), size);
}
throw executeBatchExceptionEpilogue(sqle, null, size);
} finally {
executeBatchEpilogue();
lock.unlock();
Expand Down Expand Up @@ -323,8 +326,11 @@ public long[] executeLargeBatch() throws SQLException {
return results.getCmdInformation().getLargeUpdateCounts();

} catch (SQLException sqle) {
results.commandEnd();
throw executeBatchExceptionEpilogue(sqle, results.getCmdInformation(), size);
if (results != null) {
results.commandEnd();
throw executeBatchExceptionEpilogue(sqle, results.getCmdInformation(), size);
}
throw executeBatchExceptionEpilogue(sqle, null, size);
} finally {
executeBatchEpilogue();
lock.unlock();
Expand Down
Expand Up @@ -300,8 +300,11 @@ private void executeBatchInternal(int queryParameterSize) throws SQLException {

results.commandEnd();
} catch (SQLException initialSqlEx) {
results.commandEnd();
throw executeBatchExceptionEpilogue(initialSqlEx, results.getCmdInformation(), queryParameterSize);
if (results != null) {
results.commandEnd();
throw executeBatchExceptionEpilogue(initialSqlEx, results.getCmdInformation(), queryParameterSize);
}
throw executeBatchExceptionEpilogue(initialSqlEx, null, queryParameterSize);
} finally {
executeBatchEpilogue();
lock.unlock();
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/mariadb/jdbc/MariaDbStatement.java
Expand Up @@ -1248,8 +1248,11 @@ public int[] executeBatch() throws SQLException {
return results.getCmdInformation().getUpdateCounts();

} catch (SQLException initialSqlEx) {
if (results != null) results.commandEnd();
throw executeBatchExceptionEpilogue(initialSqlEx, results.getCmdInformation(), size);
if (results != null) {
results.commandEnd();
throw executeBatchExceptionEpilogue(initialSqlEx, results.getCmdInformation(), size);
}
throw executeBatchExceptionEpilogue(initialSqlEx, null, size);
} finally {
executeBatchEpilogue();
lock.unlock();
Expand Down
Expand Up @@ -53,9 +53,9 @@
package org.mariadb.jdbc.internal.util.constant;

public final class Version {
public static final String version = "2.2.6";
public static final String version = "2.2.7-SNAPSHOT";
public static final int majorVersion = 2;
public static final int minorVersion = 2;
public static final int patchVersion = 6;
public static final String qualifier = "";
public static final int patchVersion = 7;
public static final String qualifier = "-SNAPSHOT";
}

0 comments on commit 0fe442e

Please sign in to comment.