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/20 09:28:47 UTC

[incubator-eventmesh] branch master updated: Used CollectionUtils.isempty to check null value (#2936)

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 03e84a340 Used CollectionUtils.isempty to check null value (#2936)
03e84a340 is described below

commit 03e84a34002ff22fc326e9ded085678dbb0d2837
Author: Abhinav Pratap <Th...@gmail.com>
AuthorDate: Fri Jan 20 14:58:41 2023 +0530

    Used CollectionUtils.isempty to check null value (#2936)
    
    Method checks the size of a collection against zero rather than using isEmpty(), I have changed that for better code clarity.
---
 .../org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
index fe678c468..1644934b5 100644
--- a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
@@ -57,7 +57,7 @@ public class CloudEventProducer {
     public Response publish(List<CloudEvent> events) {
         logger.info("BatchPublish message, batch size=" + events.size());
 
-        if (events.size() == 0) {
+        if (CollectionUtils.isEmpty(events)) {
             return null;
         }
         List<CloudEvent> enhancedEvents = events.stream()


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