From cc0efa3330993d328ca2d1045eee76334b9e53d4 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 29 May 2024 14:48:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/web/controller/monitor/CacheController.java | 3 ++- .../src/main/java/com/ruoyi/common/filter/XssFilter.java | 6 +++--- .../src/main/java/com/ruoyi/common/utils/DictUtils.java | 8 ++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index 41029fd91..504c0fde6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.TreeSet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisTemplate; @@ -80,7 +81,7 @@ public class CacheController public AjaxResult getCacheKeys(@PathVariable String cacheName) { Set cacheKeys = redisTemplate.keys(cacheName + "*"); - return AjaxResult.success(cacheKeys); + return AjaxResult.success(new TreeSet<>(cacheKeys)); } @PreAuthorize("@ss.hasPermi('monitor:cache:list')") diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java index 23a76fe1d..b4eaabcb6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java @@ -32,10 +32,10 @@ public class XssFilter implements Filter String tempExcludes = filterConfig.getInitParameter("excludes"); if (StringUtils.isNotEmpty(tempExcludes)) { - String[] url = tempExcludes.split(","); - for (int i = 0; url != null && i < url.length; i++) + String[] urls = tempExcludes.split(","); + for (String url : urls) { - excludes.add(url[i]); + excludes.add(url); } } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java index 39ad84a6b..89b031e5c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java @@ -56,6 +56,10 @@ public class DictUtils */ public static String getDictLabel(String dictType, String dictValue) { + if (StringUtils.isEmpty(dictValue)) + { + return StringUtils.EMPTY; + } return getDictLabel(dictType, dictValue, SEPARATOR); } @@ -68,6 +72,10 @@ public class DictUtils */ public static String getDictValue(String dictType, String dictLabel) { + if (StringUtils.isEmpty(dictLabel)) + { + return StringUtils.EMPTY; + } return getDictValue(dictType, dictLabel, SEPARATOR); }