From 5039a123aa32aa205ef6feb4a132d077c65f75aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 2 Jul 2008 20:21:27 +0200 Subject: [PATCH] substitute potential null values with empty strings --- src/de/todesbaum/jsite/main/Configuration.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/de/todesbaum/jsite/main/Configuration.java b/src/de/todesbaum/jsite/main/Configuration.java index b38e986..61803a6 100644 --- a/src/de/todesbaum/jsite/main/Configuration.java +++ b/src/de/todesbaum/jsite/main/Configuration.java @@ -331,18 +331,18 @@ public class Configuration { try { Project project = new Project(); projects.add(project); - project.setDescription(projectNode.getNode("description").getValue()); - project.setIndexFile(projectNode.getNode("index-file").getValue()); - project.setLastInsertionTime(Long.parseLong(projectNode.getNode("last-insertion-time").getValue())); - project.setLocalPath(projectNode.getNode("local-path").getValue()); - project.setName(projectNode.getNode("name").getValue()); - project.setPath(projectNode.getNode("path").getValue()); + project.setDescription(projectNode.getNode("description").getValue("")); + project.setIndexFile(projectNode.getNode("index-file").getValue("")); + project.setLastInsertionTime(Long.parseLong(projectNode.getNode("last-insertion-time").getValue("0"))); + project.setLocalPath(projectNode.getNode("local-path").getValue("")); + project.setName(projectNode.getNode("name").getValue("")); + project.setPath(projectNode.getNode("path").getValue("")); if ((project.getPath() != null) && (project.getPath().indexOf("/") != -1)) { project.setPath(project.getPath().replaceAll("/", "")); } - project.setEdition(Integer.parseInt(projectNode.getNode("edition").getValue())); - project.setInsertURI(projectNode.getNode("insert-uri").getValue()); - project.setRequestURI(projectNode.getNode("request-uri").getValue()); + project.setEdition(Integer.parseInt(projectNode.getNode("edition").getValue("0"))); + project.setInsertURI(projectNode.getNode("insert-uri").getValue("")); + project.setRequestURI(projectNode.getNode("request-uri").getValue("")); SimpleXML fileOptionsNode = projectNode.getNode("file-options"); Map fileOptions = new HashMap(); if (fileOptionsNode != null) { @@ -351,8 +351,8 @@ public class Configuration { String filename = fileOptionNode.getNode("filename").getValue(); FileOption fileOption = project.getFileOption(filename); fileOption.setInsert(Boolean.parseBoolean(fileOptionNode.getNode("insert").getValue())); - fileOption.setCustomKey(fileOptionNode.getNode("custom-key").getValue()); - fileOption.setMimeType(fileOptionNode.getNode("mime-type").getValue()); + fileOption.setCustomKey(fileOptionNode.getNode("custom-key").getValue("")); + fileOption.setMimeType(fileOptionNode.getNode("mime-type").getValue("")); fileOption.setContainer(fileOptionNode.getNode("container").getValue()); if (fileOptionNode.getNode("replace-edition") != null) { fileOption.setReplaceEdition(Boolean.parseBoolean(fileOptionNode.getNode("replace-edition").getValue())); -- 2.7.4