From 33e3851a1a625e643ece64cacc8247640bd0c470 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 19 Feb 2019 10:21:44 +0100 Subject: fix possible NullPointerException --- .../egovernment/moa/spss/server/logging/IaikLogFactory.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java index cca9117..74491d8 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java @@ -24,6 +24,7 @@ package at.gv.egovernment.moa.spss.server.logging; +import at.gv.egovernment.moaspss.logging.LoggingContext; import at.gv.egovernment.moaspss.logging.LoggingContextManager; import iaik.logging.Log; import iaik.logging.LogConfigurationException; @@ -52,10 +53,12 @@ public class IaikLogFactory extends LogFactory { * @return The iaik.logging.Log object to log messages to. */ private Log getInstanceImpl() { - String nodeID = - LoggingContextManager.getInstance().getLoggingContext().getNodeID(); - - return new IaikLog(nodeID); + LoggingContext context = LoggingContextManager.getInstance().getLoggingContext(); + if (context != null) + return new IaikLog(context.getNodeID()); + else + return new IaikLog("Internal"); + } public void release() { -- cgit v1.2.3