diff --git a/pom.xml b/pom.xml
index e6d868411f..62b451b032 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-redis
- 1.8.0.BUILD-SNAPSHOT
+ 1.8.0.DATAREDIS-509-SNAPSHOT
Spring Data Redis
diff --git a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java
index bff2eb4e8f..c503e71fea 100644
--- a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java
+++ b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java
@@ -17,11 +17,11 @@
import java.lang.reflect.Array;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -426,7 +426,7 @@ public void doWithPersistentProperty(KeyValuePersistentProperty persistentProper
persistentProperty.getTypeInformation().getComponentType(), sink);
} else if (property.getClass().isArray()) {
- writeCollection(keyspace, propertyStringPath, Arrays.asList((Object[]) property),
+ writeCollection(keyspace, propertyStringPath, CollectionUtils.arrayToList(property),
persistentProperty.getTypeInformation().getComponentType(), sink);
} else {
@@ -592,7 +592,7 @@ private Object readCollectionOrArray(String path, Class> collectionType, Class
}
}
- return isArray ? target.toArray((Object[]) Array.newInstance(valueType, target.size())) : target;
+ return isArray ? toArray(target, collectionType, valueType) : target;
}
/**
@@ -749,6 +749,30 @@ public T fromBytes(byte[] source, Class type) {
return conversionService.convert(source, type);
}
+ /**
+ * Converts a given {@link Collection} into an array considering primitive types.
+ *
+ * @param source {@link Collection} of values to be added to the array.
+ * @param arrayType {@link Class} of array.
+ * @param valueType to be used for conversion before setting the actual value.
+ * @return
+ */
+ private Object toArray(Collection