ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/50] [abbrv] ignite git commit: IGNITE-6500 Fix for POJO fields of java wrapper type are not retaining null values from Cassandra persistent store, while using ignite's CassandraCacheStoreFactory - Fixes #4014.
Date Thu, 27 Sep 2018 12:54:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-gg-14206 dd290c972 -> 3ab353367


IGNITE-6500 Fix for POJO fields of java wrapper type are not retaining null values from Cassandra
persistent store, while using ignite's CassandraCacheStoreFactory - Fixes #4014.

Signed-off-by: Dmitriy Pavlov <dpavlov@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1858acff
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1858acff
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1858acff

Branch: refs/heads/ignite-gg-14206
Commit: 1858acff7646c7aad61e8bbcd84039bb2d5a2db3
Parents: 49315c8
Author: Unknown <yashasvi.kotamraju@netcracker.com>
Authored: Mon Sep 24 18:30:08 2018 +0300
Committer: Dmitriy Pavlov <dpavlov@apache.org>
Committed: Mon Sep 24 18:30:08 2018 +0300

----------------------------------------------------------------------
 .../cassandra/common/PropertyMappingHelper.java | 66 ++++++++++++++++++--
 1 file changed, 60 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1858acff/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
index ed9f054..ea3974f 100644
--- a/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
+++ b/modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/common/PropertyMappingHelper.java
@@ -125,23 +125,77 @@ public class PropertyMappingHelper {
         if (String.class.equals(clazz))
             return row.getString(col);
 
-        if (Integer.class.equals(clazz) || int.class.equals(clazz))
+        if (Integer.class.equals(clazz))
+            return row.isNull(col) ? null : row.getInt(col);
+
+        if (int.class.equals(clazz)) {
+            if (row.isNull(col)) {
+                throw new IllegalArgumentException("Can't cast null value from Cassandra
table column '" + col +
+                        "' to " + "int value used in domain object model");
+            }
+
             return row.getInt(col);
+        }
+
+        if (Short.class.equals(clazz))
+            return row.isNull(col) ? null : row.getShort(col);
+
+        if (short.class.equals(clazz)) {
+            if (row.isNull(col)) {
+                throw new IllegalArgumentException("Can't cast null value from Cassandra
table column '" + col +
+                        "' to " + "short value used in domain object model");
+            }
 
-        if (Short.class.equals(clazz) || short.class.equals(clazz))
             return row.getShort(col);
+        }
+
+        if (Long.class.equals(clazz))
+            return row.isNull(col) ? null : row.getLong(col);
+
+        if (long.class.equals(clazz)) {
+            if (row.isNull(col)) {
+                throw new IllegalArgumentException("Can't cast null value from Cassandra
table column '" + col +
+                        "' to " + "long value used in domain object model");
+            }
 
-        if (Long.class.equals(clazz) || long.class.equals(clazz))
             return row.getLong(col);
+        }
+
+        if (Double.class.equals(clazz))
+            return row.isNull(col) ? null : row.getDouble(col);
+
+        if (double.class.equals(clazz)) {
+            if (row.isNull(col)) {
+                throw new IllegalArgumentException("Can't cast null value from Cassandra
table column '" + col +
+                        "' to " + "double value used in domain object model");
+            }
 
-        if (Double.class.equals(clazz) || double.class.equals(clazz))
             return row.getDouble(col);
+        }
+
+        if (Boolean.class.equals(clazz))
+            return row.isNull(col) ? null : row.getBool(col);
+
+        if (boolean.class.equals(clazz)) {
+            if (row.isNull(col)) {
+                throw new IllegalArgumentException("Can't cast null value from Cassandra
table column '" + col +
+                        "' to " + "boolean value used in domain object model");
+            }
 
-        if (Boolean.class.equals(clazz) || boolean.class.equals(clazz))
             return row.getBool(col);
+        }
+
+        if (Float.class.equals(clazz))
+            return row.isNull(col) ? null : row.getFloat(col);
+
+        if (float.class.equals(clazz)) {
+            if (row.isNull(col)) {
+                throw new IllegalArgumentException("Can't cast null value from Cassandra
table column '" + col +
+                        "' to " + "float value used in domain object model");
+            }
 
-        if (Float.class.equals(clazz) || float.class.equals(clazz))
             return row.getFloat(col);
+        }
 
         if (ByteBuffer.class.equals(clazz))
             return row.getBytes(col);


Mime
View raw message