【fix sonar】RedisUtil文件
This commit is contained in:
+2
-2
@@ -141,7 +141,7 @@ public class RedisUtil {
|
|||||||
*/
|
*/
|
||||||
public long incr(String key, long delta) {
|
public long incr(String key, long delta) {
|
||||||
if (delta < 0) {
|
if (delta < 0) {
|
||||||
throw new RuntimeException("递增因子必须大于0");
|
throw new IllegalArgumentException("递增因子必须大于0");
|
||||||
}
|
}
|
||||||
return redisTemplate.opsForValue().increment(key, delta);
|
return redisTemplate.opsForValue().increment(key, delta);
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ public class RedisUtil {
|
|||||||
*/
|
*/
|
||||||
public long decr(String key, long delta) {
|
public long decr(String key, long delta) {
|
||||||
if (delta < 0) {
|
if (delta < 0) {
|
||||||
throw new RuntimeException("递减因子必须大于0");
|
throw new IllegalArgumentException("递减因子必须大于0");
|
||||||
}
|
}
|
||||||
return redisTemplate.opsForValue().increment(key, -delta);
|
return redisTemplate.opsForValue().increment(key, -delta);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user