Ver código fonte

Refine AppNameUtil

master
Carpenter Lee 6 anos atrás
pai
commit
bc620d616f
1 arquivos alterados com 3 adições e 1 exclusões
  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 Ver arquivo

@@ -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;


Carregando…
Cancelar
Salvar