Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor

Christian Bauerec341357d4d6
diff --git a/container/src/main/java/org/openremote/container/util/LogUtil.java b/container/src/main/java/org/openremote/container/util/LogUtil.java
index 3ac21b826..1358789f3 100644
--- a/container/src/main/java/org/openremote/container/util/LogUtil.java
+++ b/container/src/main/java/org/openremote/container/util/LogUtil.java
@@ -23,6 +23,7 @@ import org.openremote.container.Container;
import java.io.InputStream;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.LogManager;
@@ -43,10 +44,13 @@ public class LogUtil {
// If no JUL configuration is provided
if (System.getProperty("java.util.logging.config.file") == null) {
// Load the logging configuration file specified with an environment variable
- if (System.getenv(LOGGING_CONFIG_FILE) != null &&
- Files.isReadable(Paths.get(System.getenv(LOGGING_CONFIG_FILE)))) {
- try (InputStream is = Files.newInputStream(Paths.get(System.getenv(LOGGING_CONFIG_FILE)))) {
- System.out.println("Using logging configuration: " + Paths.get(System.getenv(LOGGING_CONFIG_FILE)).toAbsolutePath());
+ if (System.getenv(LOGGING_CONFIG_FILE) != null) {
+ Path loggingConfigFile = Paths.get(System.getenv(LOGGING_CONFIG_FILE));
+ if (!Files.isReadable(loggingConfigFile)) {
+ throw new ExceptionInInitializerError("LOGGING_CONFIG_FILE is not readable: " + loggingConfigFile.toAbsolutePath());
+ }
+ try (InputStream is = Files.newInputStream(loggingConfigFile)) {
+ System.out.println("Using logging configuration: " + loggingConfigFile.toAbsolutePath());
LogManager.getLogManager().readConfiguration(is);
} catch (Exception ex) {
throw new ExceptionInInitializerError(ex);
diff --git a/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java b/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java
index c05bd0692..6bc5cdf6c 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java
@@ -475,7 +475,11 @@ public class RulesEngine<T extends Ruleset> {
runningFuture = executorService.getRulesExecutor().submit(() -> {
boolean stoppedOnError = false;
try {
- knowledgeSession.fireUntilHalt();
+ if (knowledgeSession != null) {
+ knowledgeSession.fireUntilHalt();
+ } else {
+ LOG.log(Level.SEVERE, "On " + RulesEngine.this + ", can't fire until halt, no knowledge session exists");
+ }
} catch (Exception ex) {
// Errors in rule RHS
LOG.log(Level.SEVERE, "On " + RulesEngine.this + ", error firing rules", ex);