You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2017/08/08 05:08:52 UTC
[7/7] phoenix git commit: PHOENIX-4072 Prevent NPE for
PreparedStatement.setObject of null
PHOENIX-4072 Prevent NPE for PreparedStatement.setObject of null
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d762c6a8
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d762c6a8
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d762c6a8
Branch: refs/heads/master
Commit: d762c6a83e8260297fd8d6afcb51bc1c49dce23f
Parents: 1e74895
Author: James Taylor <ja...@apache.org>
Authored: Mon Aug 7 11:56:23 2017 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Mon Aug 7 22:08:36 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d762c6a8/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java
index 9bba3d3..71ecb8d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java
@@ -444,8 +444,10 @@ public class PhoenixPreparedStatement extends PhoenixStatement implements Prepar
@Override
public void setObject(int parameterIndex, Object o, int targetSqlType) throws SQLException {
PDataType targetType = PDataType.fromTypeId(targetSqlType);
- PDataType sourceType = PDataType.fromLiteral(o);
- o = targetType.toObject(o, sourceType);
+ if (o != null) {
+ PDataType sourceType = PDataType.fromLiteral(o);
+ o = targetType.toObject(o, sourceType);
+ }
setParameter(parameterIndex, o);
}