瀏覽代碼

Refine AppNameUtil

master
Carpenter Lee 6 年之前
父節點
當前提交
bc620d616f
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/AppNameUtil.java

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

@@ -47,6 +47,8 @@ public final class AppNameUtil {

public static final String APP_NAME = "project.name";
public static final String SUN_JAVA_COMMAND = "sun.java.command";
private static final String JAR_SUFFIX_LOWER = ".jar";
private static final String JAR_SUFFIX_UPPER = ".JAR";

private static String appName;

@@ -76,7 +78,7 @@ public final class AppNameUtil {
String[] strs = command.split(File.separator);
command = strs[strs.length - 1];
}
if (command.endsWith(".jar") || command.endsWith(".JAR")) {
if (command.endsWith(JAR_SUFFIX_LOWER) || command.endsWith(JAR_SUFFIX_UPPER)) {
command = command.substring(0, command.length() - 4);
}
appName = command;


Loading…
取消
儲存