瀏覽代碼

Fixes #52: Error file separator regex in Windows environment

- This bug can cause init failure of `AppNameUtil`

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 6 年之前
父節點
當前提交
227776a301
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. +8
    -2
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/AppNameUtil.java

+ 8
- 2
sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/AppNameUtil.java 查看文件

@@ -74,8 +74,14 @@ public final class AppNameUtil {
return;
}
command = command.split("\\s")[0];
if (command.contains(File.separator)) {
String[] strs = command.split(File.separator);
String separator = File.separator;
if (command.contains(separator)) {
String[] strs;
if ("\\".equals(separator)) {
strs = command.split("\\\\");
} else {
strs = command.split(separator);
}
command = strs[strs.length - 1];
}
if (command.endsWith(JAR_SUFFIX_LOWER) || command.endsWith(JAR_SUFFIX_UPPER)) {


Loading…
取消
儲存