Проверки на null для "защиты от дурака"

This commit is contained in:
Gravit 2019-01-03 22:17:15 +07:00
parent 1b12dd895a
commit 45666e6090
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -106,6 +106,7 @@ public static void main(String[] args) throws Throwable {
}
Class<?> mainClass;
if (config.customClassPath) {
if(config.classpath == null) throw new UnsupportedOperationException("classpath is null, customClassPath not available");
String[] cp = config.classpath.split(":");
if (!ServerAgent.isAgentStarted()) {
LogHelper.warning("JavaAgent not found. Using URLClassLoader");
@ -123,6 +124,7 @@ public static void main(String[] args) throws Throwable {
if (!ServerAgent.isAgentStarted()) {
throw new UnsupportedOperationException("JavaAgent not found, autoloadLibraries not available");
}
if(config.librariesDir == null) throw new UnsupportedOperationException("librariesDir is null, autoloadLibraries not available");
Path librariesDir = Paths.get(config.librariesDir);
LogHelper.info("Load libraries");
ServerAgent.loadLibraries(librariesDir);