From 2743785aafd8a9156b65f2a24a0dc388594233d0 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 13 Dec 2021 10:11:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=80=97=E5=8F=B7=E5=88=86=E9=9A=94=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/quartz/util/JobInvokeUtil.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java index 4cde0ec44..663b4a1f1 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java @@ -65,7 +65,7 @@ public class JobInvokeUtil /** * 校验是否为为class包名 * - * @param str 名称 + * @param invokeTarget 名称 * @return true是 false否 */ public static boolean isValidClassName(String invokeTarget) @@ -110,30 +110,30 @@ public class JobInvokeUtil { return null; } - String[] methodParams = methodStr.split(",(?=(?:[^\']*\"[^\']*\')*[^\']*$)"); + String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)"); List classs = new LinkedList<>(); for (int i = 0; i < methodParams.length; i++) { String str = StringUtils.trimToEmpty(methodParams[i]); - // String字符串类型,包含' - if (StringUtils.contains(str, "'")) + // String字符串类型,以'或"开头 + if (StringUtils.startsWithAny(str, "'", "\"")) { - classs.add(new Object[] { StringUtils.replace(str, "'", ""), String.class }); + classs.add(new Object[] { StringUtils.substring(str, 1, str.length() - 1), String.class }); } // boolean布尔类型,等于true或者false - else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false")) + else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str)) { classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); } - // long长整形,包含L - else if (StringUtils.containsIgnoreCase(str, "L")) + // long长整形,以L结尾 + else if (StringUtils.endsWith(str, "L")) { - classs.add(new Object[] { Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class }); + classs.add(new Object[] { Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class }); } - // double浮点类型,包含D - else if (StringUtils.containsIgnoreCase(str, "D")) + // double浮点类型,以D结尾 + else if (StringUtils.endsWith(str, "D")) { - classs.add(new Object[] { Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), Double.class }); + classs.add(new Object[] { Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class }); } // 其他类型归类为整形 else