Class ApplicationUtil

java.lang.Object
org.summerboot.jexpress.util.ApplicationUtil

public class ApplicationUtil extends Object
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Field Details

    • EMPTY_ARGS

      public static final String[] EMPTY_ARGS
    • JAVA_COMMAND_SUN

      protected static final String JAVA_COMMAND_SUN
      Sun property pointing the main class and its arguments. Might not be defined on non Hotspot VM implementations.
      See Also:
    • RESOURCE_PATH

      public static final String RESOURCE_PATH
      See Also:
  • Constructor Details

    • ApplicationUtil

      public ApplicationUtil()
  • Method Details

    • getApplicationArgs

      public static String[] getApplicationArgs()
    • scanJVM_StartCommand

      public static boolean scanJVM_StartCommand(StringBuilder cmd)
      java -XshowSettings:properties -version
      Parameters:
      cmd -
      Returns:
      true if JMX is required
    • checkDuplicateFields

      public static Map<Object,Set<String>> checkDuplicateFields(Class errorCodeClass, Class fieldClass) throws IllegalArgumentException, IllegalAccessException
      Throws:
      IllegalArgumentException
      IllegalAccessException
    • getServerName

      public static String getServerName(boolean exitWhenFail)
    • getClassNamesFromJarFile

      public static Set<String> getClassNamesFromJarFile(File jarFile) throws IOException
      Throws:
      IOException
    • loadClassFromJarFile

      public static Set<Class<?>> loadClassFromJarFile(File jarFile, boolean failOnUndefinedClasses) throws IOException
      CWE-470 warning: use with caution, validate the class name against a combination of white and black lists to ensure that only expeted classes are loaded
      Parameters:
      jarFile -
      failOnUndefinedClasses -
      Returns:
      Throws:
      IOException
    • createIfNotExist

      public static Path createIfNotExist(String location, ClassLoader classLoader, String srcFileName, String destFileName)
    • RTO

      public static void RTO(int code, String msg, Throwable ex)
      Rejected Takeoff
      Parameters:
      code -
      msg -
      ex -