From 0417a4ebdf67b6e64090d10b539db27cda8677e7 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Thu, 12 Mar 2020 10:14:07 +0100 Subject: [PATCH] [Minor] Code cleanup in StrolchBootstrapper --- .../agent/api/StrolchBootstrapper.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchBootstrapper.java b/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchBootstrapper.java index e15adadd6..b9c363ab6 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchBootstrapper.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/api/StrolchBootstrapper.java @@ -1,17 +1,13 @@ package li.strolch.agent.api; +import static java.util.Objects.requireNonNull; + import java.io.File; import java.io.InputStream; import java.text.MessageFormat; import java.util.Arrays; import java.util.Properties; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - import li.strolch.runtime.configuration.ConfigurationParser; import li.strolch.runtime.configuration.StrolchConfigurationException; import li.strolch.runtime.configuration.StrolchEnvironment; @@ -19,6 +15,11 @@ import li.strolch.utils.dbc.DBC; import li.strolch.utils.helper.FileHelper; import li.strolch.utils.helper.StringHelper; import li.strolch.utils.helper.XmlHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; public class StrolchBootstrapper extends DefaultHandler { @@ -74,6 +75,7 @@ public class StrolchBootstrapper extends DefaultHandler { *

* * @param appVersion + * the app's version */ public StrolchBootstrapper(StrolchVersion appVersion) { DBC.PRE.assertNotNull("appVersion must be set!", appVersion); @@ -100,8 +102,7 @@ public class StrolchBootstrapper extends DefaultHandler { "Could not find resource " + APP_VERSION_PROPERTIES + " on ClassLoader of class " + appClass); } - StrolchVersion appVersion = new StrolchVersion(env); - this.appVersion = appVersion; + this.appVersion = new StrolchVersion(env); } public void setEnvironmentOverride(String environmentOverride) { @@ -163,7 +164,7 @@ public class StrolchBootstrapper extends DefaultHandler { msg = MessageFormat.format(msg, environment, rootDstPath.getAbsolutePath()); throw new StrolchConfigurationException(msg); } - if (rootDstPath.list().length != 0) { + if (requireNonNull(rootDstPath.list()).length != 0) { String msg = "[{0}] Destination root exists and is not empty at {1}"; //$NON-NLS-1$ msg = MessageFormat.format(msg, environment, rootDstPath.getAbsolutePath()); throw new StrolchConfigurationException(msg); @@ -328,7 +329,6 @@ public class StrolchBootstrapper extends DefaultHandler { } private void parseBoostrapFile(File bootstrapFile) { - // parse the document using ourselves as the DefaultHandler XmlHelper.parseDocument(bootstrapFile, this);