Don’t try to parse null values.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index 84e813e..8563187 100644 (file)
@@ -46,6 +46,9 @@ public class Core extends AbstractService {
        /** The configuration. */
        private Configuration configuration;
 
+       /** Interface to freenet. */
+       private FreenetInterface freenetInterface;
+
        /** The local Sones. */
        private final Set<Sone> localSones = new HashSet<Sone>();
 
@@ -72,6 +75,18 @@ public class Core extends AbstractService {
                return this;
        }
 
+       /**
+        * Sets the Freenet interface to use.
+        *
+        * @param freenetInterface
+        *            The Freenet interface to use
+        * @return This core (for method chaining)
+        */
+       public Core freenetInterface(FreenetInterface freenetInterface) {
+               this.freenetInterface = freenetInterface;
+               return this;
+       }
+
        //
        // ACTIONS
        //
@@ -99,7 +114,10 @@ public class Core extends AbstractService {
                logger.entering(Core.class.getName(), "loadConfiguration()");
 
                /* get names of all local Sones. */
-               String allSoneNamesString = configuration.getStringValue("Sone/Names").getValue("");
+               String allSoneNamesString = configuration.getStringValue("Sone/Names").getValue(null);
+               if (allSoneNamesString == null) {
+                       allSoneNamesString = "";
+               }
                List<String> allSoneNames;
                try {
                        allSoneNames = StringEscaper.parseLine(allSoneNamesString);