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

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


The following commit(s) were added to refs/heads/master by this push:
     new c40405cd5 Comparing N objects for null with Assert.noNullElements(). 
(#1814)
c40405cd5 is described below

commit c40405cd58da00e05e54ddca6fdaaa97cc273d49
Author: Hyeon Sung <[email protected]>
AuthorDate: Tue Apr 23 00:45:45 2024 +0900

    Comparing N objects for null with Assert.noNullElements(). (#1814)
---
 .../hertzbeat/collector/collect/redis/RedisCommonCollectImpl.java     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/redis/RedisCommonCollectImpl.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/redis/RedisCommonCollectImpl.java
index 69d703097..eb022844d 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/redis/RedisCommonCollectImpl.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/redis/RedisCommonCollectImpl.java
@@ -330,9 +330,7 @@ public class RedisCommonCollectImpl extends AbstractCollect 
{
     }
 
     private void preCheck(Metrics metrics) {
-        if (metrics == null || metrics.getRedis() == null) {
-            throw new IllegalArgumentException("Redis collect must has redis 
params");
-        }
+       Assert.noNullElements(new Object[] {metrics, metrics.getRedis()}, 
"Redis collect must has redis params");
         RedisProtocol redisProtocol = metrics.getRedis();
         Assert.hasText(redisProtocol.getHost(), "Redis Protocol host is 
required.");
         Assert.hasText(redisProtocol.getPort(), "Redis Protocol port is 
required.");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to