implemented halt on startup errors

This commit is contained in:
2025-10-02 08:59:01 +02:00
parent c08e1f8a04
commit 41934b6f18
4 changed files with 26 additions and 27 deletions

View File

@@ -3,6 +3,7 @@ package de.srsoftware.umbrella.backend;
import static de.srsoftware.umbrella.core.Constants.*;
import static de.srsoftware.umbrella.core.Util.mapLogLevel;
import static java.lang.System.Logger.Level.ERROR;
import static java.lang.System.Logger.Level.INFO;
import com.sun.net.httpserver.HttpServer;
@@ -58,7 +59,7 @@ public class Application {
config.get("umbrella.plantuml").map(Object::toString).map(File::new).filter(File::exists).ifPresent(Util::setPlantUmlJar);
var server = HttpServer.create(new InetSocketAddress(port), 0);
try {
new Translations().bindPath("/api/translations").on(server);
new MessageSystem(config);
new UserModule(config).bindPath("/api/user").on(server);
@@ -79,7 +80,10 @@ public class Application {
new TimeModule(config).bindPath("/api/time").on(server);
new WebHandler().bindPath("/").on(server);
new WikiModule(config).bindPath("/api/wiki").on(server);
} catch (Exception e) {
LOG.log(ERROR,"Startup failed",e);
System.exit(-1);
}
server.setExecutor(Executors.newFixedThreadPool(threads));
server.start();
LOG.log(INFO,"Started web server at port {0}",port);

View File

@@ -13,7 +13,6 @@ import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
import static de.srsoftware.umbrella.core.model.Permission.*;
import static de.srsoftware.umbrella.project.Constants.PERMISSIONS;
import static de.srsoftware.umbrella.task.Constants.*;
import static java.lang.System.Logger.Level.DEBUG;
import static java.lang.System.Logger.Level.WARNING;
import com.sun.net.httpserver.HttpExchange;

View File

@@ -10,7 +10,6 @@ import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
import static de.srsoftware.umbrella.core.model.Time.State.Open;
import static de.srsoftware.umbrella.core.model.Time.State.Started;
import static de.srsoftware.umbrella.time.Constants.*;
import static java.util.stream.Collectors.toSet;
import com.sun.net.httpserver.HttpExchange;
import de.srsoftware.configuration.Configuration;

View File

@@ -34,13 +34,10 @@ import java.util.*;
public class SqliteDB extends BaseDb implements LoginServiceDb, UserDb {
private static final System.Logger LOG = System.getLogger(SqliteDB.class.getSimpleName());
private static final int INITIAL_DB_VERSION = 4;
public SqliteDB(Connection conn){
super(conn);
}
private void createLoginServiceTables() {
var createTable = """
CREATE TABLE IF NOT EXISTS {0} (