You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by jo...@apache.org on 2023/01/13 06:53:12 UTC

[incubator-eventmesh] branch master updated: [ISSUE #2714] Method checks the size of a collection against zero rather than using isEmpty() [HttpClientGroupMapping] (#2847)

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

jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 73b6b736a [ISSUE #2714] Method checks the size of a collection against zero rather than using isEmpty() [HttpClientGroupMapping] (#2847)
73b6b736a is described below

commit 73b6b736abd76f41826aa5cd559e580a3f22c1bb
Author: Tarun Samanta <55...@users.noreply.github.com>
AuthorDate: Fri Jan 13 12:23:06 2023 +0530

    [ISSUE #2714] Method checks the size of a collection against zero rather than using isEmpty() [HttpClientGroupMapping] (#2847)
    
    * First Commit
    
    * Changed mapUtils to collectionUtils
    
    * fixed ci error
    
    * fixed ci error
---
 .../runtime/core/protocol/http/consumer/HttpClientGroupMapping.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
index a0b2186be..11c21dd4e 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
@@ -17,6 +17,7 @@
 
 package org.apache.eventmesh.runtime.core.protocol.http.consumer;
 
+
 import org.apache.eventmesh.common.protocol.SubscriptionItem;
 import org.apache.eventmesh.common.protocol.http.header.client.SubscribeRequestHeader;
 import org.apache.eventmesh.common.protocol.http.header.client.UnSubscribeRequestHeader;
@@ -27,6 +28,7 @@ import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupTopicConf;
 import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupTopicMetadata;
 import org.apache.eventmesh.runtime.core.protocol.http.processor.inf.Client;
 
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 
@@ -357,14 +359,14 @@ public final class HttpClientGroupMapping {
             }
         }
 
-        if (isChange && consumerGroupTopicConf.getUrls().size() == 0) {
+        if (isChange && CollectionUtils.isEmpty(consumerGroupTopicConf.getUrls())) {
             consumerGroupConf.getConsumerGroupTopicConf().remove(unSubTopic);
             if (LOGGER.isInfoEnabled()) {
                 LOGGER.info("group unsubscribe topic success,group:{}, topic:{}", consumerGroup, unSubTopic);
             }
         }
 
-        if (isChange && consumerGroupConf.getConsumerGroupTopicConf().size() == 0) {
+        if (isChange && MapUtils.isEmpty(consumerGroupConf.getConsumerGroupTopicConf())) {
             localConsumerGroupMapping.remove(consumerGroup);
             if (LOGGER.isInfoEnabled()) {
                 LOGGER.info("group unsubscribe success,group:{}", consumerGroup);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org