geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject [geode] branch feature/GEODE-3273 updated: GEODE-3273: only to catch exception of toDocuments()
Date Wed, 27 Sep 2017 00:48:52 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/feature/GEODE-3273 by this push:
     new 58cf3e8  GEODE-3273: only to catch exception of toDocuments()
58cf3e8 is described below

commit 58cf3e8c5d08133bae22cd3ee07145fa72a1a976
Author: zhouxh <gzhou@pivotal.io>
AuthorDate: Tue Sep 26 17:48:19 2017 -0700

    GEODE-3273: only to catch exception of toDocuments()
---
 .../internal/repository/IndexRepositoryImpl.java   | 23 ++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
index 3eb6ba5..4a856a0 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
@@ -35,6 +35,7 @@ import org.apache.geode.distributed.LockNotHeldException;
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.function.IntSupplier;
 
 /**
@@ -78,13 +79,16 @@ public class IndexRepositoryImpl implements IndexRepository {
   @Override
   public void create(Object key, Object value) throws IOException {
     long start = stats.startUpdate();
+    Collection<Document> docs = Collections.emptyList();
     try {
-      Collection<Document> docs = serializer.toDocuments(index, value);
+      try {
+        docs = serializer.toDocuments(index, value);
+      } catch (Exception e) {
+        stats.incFailedEntries();
+        logger.info("Failed to add index for " + value + " due to " + e.getMessage());
+      }
       docs.forEach(doc -> SerializerUtil.addKey(key, doc));
       writer.addDocuments(docs);
-    } catch (Exception e) {
-      stats.incFailedEntries();
-      logger.info("Failed to add index for " + value + " due to " + e.getMessage());
     } finally {
       stats.endUpdate(start);
     }
@@ -93,14 +97,17 @@ public class IndexRepositoryImpl implements IndexRepository {
   @Override
   public void update(Object key, Object value) throws IOException {
     long start = stats.startUpdate();
+    Collection<Document> docs = Collections.emptyList();
     try {
-      Collection<Document> docs = serializer.toDocuments(index, value);
+      try {
+        docs = serializer.toDocuments(index, value);
+      } catch (Exception e) {
+        stats.incFailedEntries();
+        logger.info("Failed to update index for " + value + " due to " + e.getMessage());
+      }
       docs.forEach(doc -> SerializerUtil.addKey(key, doc));
       Term keyTerm = SerializerUtil.toKeyTerm(key);
       writer.updateDocuments(keyTerm, docs);
-    } catch (Exception e) {
-      stats.incFailedEntries();
-      logger.info("Failed to update index for " + value + " due to " + e.getMessage());
     } finally {
       stats.endUpdate(start);
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message