From 97184275a3cbce057aeef3c048f44b49ef726a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Mon, 3 Apr 2023 18:21:53 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91RedisUtil=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/jero/common/util/RedisUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/util/RedisUtil.java b/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/util/RedisUtil.java index beba0f71..ce8c468d 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/util/RedisUtil.java +++ b/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/util/RedisUtil.java @@ -141,7 +141,7 @@ public class RedisUtil { */ public long incr(String key, long delta) { if (delta < 0) { - throw new RuntimeException("递增因子必须大于0"); + throw new IllegalArgumentException("递增因子必须大于0"); } return redisTemplate.opsForValue().increment(key, delta); } @@ -155,7 +155,7 @@ public class RedisUtil { */ public long decr(String key, long delta) { if (delta < 0) { - throw new RuntimeException("递减因子必须大于0"); + throw new IllegalArgumentException("递减因子必须大于0"); } return redisTemplate.opsForValue().increment(key, -delta); }