streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfrank...@apache.org
Subject [3/5] git commit: STREAMS-152 | Code review feedback
Date Mon, 25 Aug 2014 16:51:56 GMT
STREAMS-152 | Code review feedback


Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/14f5d08b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/14f5d08b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/14f5d08b

Branch: refs/heads/master
Commit: 14f5d08b937b311ca858124822aea9d5d78f9a8d
Parents: c082d47
Author: Robert Douglas <rdouglas@w2odigital.com>
Authored: Thu Aug 21 09:22:21 2014 -0500
Committer: Robert Douglas <rdouglas@w2odigital.com>
Committed: Thu Aug 21 09:22:21 2014 -0500

----------------------------------------------------------------------
 .../elasticsearch/ElasticsearchPersistWriter.java       | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/14f5d08b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
index 10bb3b0..67866cc 100644
--- a/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
+++ b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchPersistWriter.java
@@ -144,18 +144,16 @@ public class ElasticsearchPersistWriter implements StreamsPersistWriter,
DatumSt
 
         checkForBackOff();
 
-        String index = Optional.fromNullable(
-                (String) streamsDatum.getMetadata().get("index"))
-                .or("");
-        String type = Optional.fromNullable(
-                (String) streamsDatum.getMetadata().get("type"))
-                .or(config.getType());
+        String index = (String) streamsDatum.getMetadata().get("index");
+        String type = (String) streamsDatum.getMetadata().get("type");
         String id = Optional.fromNullable(
                 (String) streamsDatum.getMetadata().get("id"))
                 .or(streamsDatum.getId());
 
-        if(config.getForceUseConfig()) {
+        if(index == null || config.getForceUseConfig()) {
             index = config.getIndex();
+        }
+        if(type == null || config.getForceUseConfig()) {
             type = config.getType();
         }
 


Mime
View raw message