Repository: ignite Updated Branches: refs/heads/ignite-1753-1282 a0ab8f9a1 -> aa8088c72
IGNITE-1753 WIP debug NPE in cache store tx-put. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aa8088c7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aa8088c7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aa8088c7 Branch: refs/heads/ignite-1753-1282 Commit: aa8088c72779a26df0650aa38acb4e245eb55021 Parents: a0ab8f9 Author: Alexey Kuznetsov <[email protected]> Authored: Thu Nov 12 16:37:17 2015 +0700 Committer: Alexey Kuznetsov <[email protected]> Committed: Thu Nov 12 16:37:17 2015 +0700 ---------------------------------------------------------------------- .../store/jdbc/CacheAbstractJdbcStore.java | 32 +++++++++++--------- 1 file changed, 18 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/aa8088c7/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java index 764b377..f44571a 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java @@ -385,22 +385,26 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>, Transaction tx = ses.transaction(); if (tx != null) { - Connection conn = ses.<String, Connection>properties().remove(ATTR_CONN_PROP); + Map<String, Connection> sesProps = ses.properties(); - assert conn != null; + Connection conn = sesProps.get(ATTR_CONN_PROP); - try { - if (commit) - conn.commit(); - else - conn.rollback(); - } - catch (SQLException e) { - throw new CacheWriterException( - "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e); - } - finally { - U.closeQuiet(conn); + if (conn != null) { + sesProps.remove(ATTR_CONN_PROP); + + try { + if (commit) + conn.commit(); + else + conn.rollback(); + } + catch (SQLException e) { + throw new CacheWriterException( + "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e); + } + finally { + U.closeQuiet(conn); + } } if (log.isDebugEnabled())
