Fix exception in EngineInformation during startup
This commit is contained in:
parent
116bc4b0b9
commit
1a42e4bbc6
2 changed files with 13 additions and 6 deletions
|
@ -105,6 +105,9 @@ public final class Engine implements SubsystemMainClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
long initTime = Miscellaneous.measureExecutionTime(() -> {
|
long initTime = Miscellaneous.measureExecutionTime(() -> {
|
||||||
|
// Initialize variables
|
||||||
|
logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
||||||
|
|
||||||
// Initialize EngineConfiguration and load it
|
// Initialize EngineConfiguration and load it
|
||||||
new EngineConfiguration();
|
new EngineConfiguration();
|
||||||
EngineConfiguration.getInstance().loadConfiguration();
|
EngineConfiguration.getInstance().loadConfiguration();
|
||||||
|
@ -120,9 +123,6 @@ public final class Engine implements SubsystemMainClass {
|
||||||
|
|
||||||
// Start threads
|
// Start threads
|
||||||
startThreads();
|
startThreads();
|
||||||
|
|
||||||
// Initialize variables
|
|
||||||
logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info("Initialized sos!engine v%engine_version% (commit %engine_git_commit_id_long%-%engine_git_branch%, dirty %engine_git_dirty%) in " + initTime + "ms");
|
logger.info("Initialized sos!engine v%engine_version% (commit %engine_git_commit_id_long%-%engine_git_branch%, dirty %engine_git_dirty%) in " + initTime + "ms");
|
||||||
|
@ -138,6 +138,8 @@ public final class Engine implements SubsystemMainClass {
|
||||||
new EngineInformation();
|
new EngineInformation();
|
||||||
new PlaceholderEngine();
|
new PlaceholderEngine();
|
||||||
new ShortcodeConverter();
|
new ShortcodeConverter();
|
||||||
|
|
||||||
|
EngineInformation.getInstance().load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,6 +26,7 @@ import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||||
import de.staropensource.sosengine.base.types.CodePart;
|
import de.staropensource.sosengine.base.types.CodePart;
|
||||||
import de.staropensource.sosengine.base.types.VersionType;
|
import de.staropensource.sosengine.base.types.VersionType;
|
||||||
import de.staropensource.sosengine.base.utility.PropertyParser;
|
import de.staropensource.sosengine.base.utility.PropertyParser;
|
||||||
|
import de.staropensource.sosengine.base.utility.StackTraceParser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -360,8 +361,9 @@ public final class EngineInformation {
|
||||||
Properties gradleProperties = new Properties();
|
Properties gradleProperties = new Properties();
|
||||||
InputStream gradleStream = this.getClass().getClassLoader().getResourceAsStream("gradle.properties");
|
InputStream gradleStream = this.getClass().getClassLoader().getResourceAsStream("gradle.properties");
|
||||||
|
|
||||||
if (inputStream == null) {
|
if (gradleStream == null) {
|
||||||
logger.crash("Unable to load build information: The bundled gradle.properties file could not be found. Do symlinks work on the system that built this JAR?");
|
System.out.println("Unable to load build information: The bundled gradle.properties file could not be found. Do symlinks work on the system that built this JAR?");
|
||||||
|
Engine.getInstance().shutdown(69);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +371,10 @@ public final class EngineInformation {
|
||||||
gradleProperties.load(gradleStream);
|
gradleProperties.load(gradleStream);
|
||||||
gradleStream.close();
|
gradleStream.close();
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
logger.crash("Unable to load build information: InputStream failed", exception);
|
StackTraceParser parser = new StackTraceParser(exception);
|
||||||
|
System.out.println("Unable to load build information: InputStream 'gradleStream' failed");
|
||||||
|
System.out.println(parser.getHeader() + "\n" + parser.getStackTrace());
|
||||||
|
Engine.getInstance().shutdown(69);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue