phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [4/7] phoenix git commit: PHOENIX-4072 Prevent NPE for PreparedStatement.setObject of null
Date Tue, 08 Aug 2017 06:04:04 GMT
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/c3d3a081
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c3d3a081
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c3d3a081

Branch: refs/heads/4.x-HBase-1.2
Commit: c3d3a081bcf2876f7b7049ad1d6dd503f1e09292
Parents: 5e7713c
Author: James Taylor <jamestaylor@apache.org>
Authored: Mon Aug 7 11:56:23 2017 -0700
Committer: James Taylor <jamestaylor@apache.org>
Committed: Mon Aug 7 22:59:47 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/c3d3a081/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);
     }
 


Mime
View raw message