[camel] branch master updated (f8a40ba -> d0c9615)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch master updated (f8a40ba -> d0c9615)

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

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from f8a40ba  Upgrade Hibernate Validator to version 6.0.13.Final
     new 99b2c83  CAMEL-12806 - Camel-Slack: Add a check on the messages list while consuming
     new d0c9615  CAMEL-12806 - Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/slack/SlackConsumer.java       | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[camel] 01/02: CAMEL-12806 - Camel-Slack: Add a check on the messages list while consuming

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

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 99b2c8320e0114128b08253f8c311441e07128ca
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Thu Sep 13 12:02:56 2018 +0200

    CAMEL-12806 - Camel-Slack: Add a check on the messages list while consuming
---
 .../camel/component/slack/SlackConsumer.java       | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
index 948a38c..5ae6f2a 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.slack;
 
+import static org.apache.camel.component.slack.utils.SlackUtils.readResponse;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -41,8 +43,6 @@ import org.json.simple.parser.ParseException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.camel.component.slack.utils.SlackUtils.readResponse;
-
 public class SlackConsumer extends ScheduledBatchPollingConsumer {
 
     private static final Logger LOG = LoggerFactory.getLogger(SlackConsumer.class);
@@ -85,17 +85,19 @@ public class SlackConsumer extends ScheduledBatchPollingConsumer {
 
     private Queue<Exchange> createExchanges(List list) {
         Queue<Exchange> answer = new LinkedList<>();
-        Iterator it = list.iterator();
-        int i = 0;
-        while (it.hasNext()) {
-            Object object = (Object)it.next();
-            JSONObject singleMess = (JSONObject)object;
-            if (i == 0) {
-                timestamp = (String)singleMess.get("ts");
+        if (ObjectHelper.isNotEmpty(list)) {
+            Iterator it = list.iterator();
+            int i = 0;
+            while (it.hasNext()) {
+                Object object = (Object)it.next();
+                JSONObject singleMess = (JSONObject)object;
+                if (i == 0) {
+                    timestamp = (String)singleMess.get("ts");
+                }
+                i++;
+                Exchange exchange = slackEndpoint.createExchange(singleMess);
+                answer.add(exchange);
             }
-            i++;
-            Exchange exchange = slackEndpoint.createExchange(singleMess);
-            answer.add(exchange);
         }
         return answer;
     }

Reply | Threaded
Open this post in threaded view
|

[camel] 02/02: CAMEL-12806 - Fixed CS

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d0c96158861d2a88b840802a468564082564d6cc
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Thu Sep 13 12:07:20 2018 +0200

    CAMEL-12806 - Fixed CS
---
 .../src/main/java/org/apache/camel/component/slack/SlackConsumer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
index 5ae6f2a..5c665d5 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.slack;
 
-import static org.apache.camel.component.slack.utils.SlackUtils.readResponse;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -43,6 +41,8 @@ import org.json.simple.parser.ParseException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.slack.utils.SlackUtils.readResponse;
+
 public class SlackConsumer extends ScheduledBatchPollingConsumer {
 
     private static final Logger LOG = LoggerFactory.getLogger(SlackConsumer.class);