This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch feature/GEODE-3245
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-3245 by this 
push:
     new 32e8c0b  GEODE-3245: fix iteration of primitive array
32e8c0b is described below

commit 32e8c0b63dae123343b3ae34034e61f6ca36dfa1
Author: zhouxh <[email protected]>
AuthorDate: Fri Oct 20 17:10:42 2017 -0700

    GEODE-3245: fix iteration of primitive array
---
 .../apache/geode/cache/lucene/FlatFormatSerializer.java    | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git 
a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
 
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
index 3edbb99..9f3664e 100644
--- 
a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
+++ 
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.cache.lucene;
 
+import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.util.Arrays;
 import java.util.Collection;
@@ -98,16 +99,9 @@ public class FlatFormatSerializer implements 
LuceneSerializer {
     }
 
     if (fieldValue.getClass().isArray()) {
-      if (fieldValue instanceof int[]) {
-        int[] array = (int[]) fieldValue;
-        for (int item : array) {
-          addFieldValueForNonCollectionObject(doc, indexedFieldName, item, 
tokenizedFields);
-        }
-      } else {
-        Object[] array = (Object[]) fieldValue;
-        for (Object item : array) {
-          addFieldValueForNonCollectionObject(doc, indexedFieldName, item, 
tokenizedFields);
-        }
+      for (int i = 0; i < Array.getLength(fieldValue); i++) {
+        Object item = Array.get(fieldValue, i);
+        addFieldValueForNonCollectionObject(doc, indexedFieldName, item, 
tokenizedFields);
       }
     } else if (fieldValue instanceof Collection) {
       Collection collection = (Collection) fieldValue;

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to