From: David ‘Bombe’ Roden Date: Mon, 2 Jun 2008 11:20:27 +0000 (+0200) Subject: fix loading of overrides X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d6015942121ba0e43177da20c3559126e9c6dafe;p=jSite2.git fix loading of overrides --- diff --git a/src/net/pterodactylus/jsite/project/ProjectManager.java b/src/net/pterodactylus/jsite/project/ProjectManager.java index 8f1cb8a..35436ca 100644 --- a/src/net/pterodactylus/jsite/project/ProjectManager.java +++ b/src/net/pterodactylus/jsite/project/ProjectManager.java @@ -30,9 +30,10 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map.Entry; import java.util.Properties; import java.util.Random; +import java.util.Map.Entry; +import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.jsite.core.JSiteException; @@ -150,10 +151,11 @@ public class ProjectManager implements PropertyChangeListener { project.setBasePath(projectBasePath); project.setDefaultFile(projectDefaultFile); int overrideIndex = 0; - while (projectProperties.containsKey(projectPrefix + ".overrides." + overrideIndex)) { + while (projectProperties.containsKey(projectPrefix + ".overrides." + overrideIndex + ".override")) { String filePath = projectProperties.getProperty(projectPrefix + ".overrides." + overrideIndex + ".filePath"); FileOverride override = FileOverride.valueOf(projectProperties.getProperty(projectPrefix + ".overrides." + overrideIndex + ".override")); project.addFileOverride(filePath, override); + logger.log(Level.FINEST, "read override: " + filePath + ", " + override); overrideIndex++; } projects.add(project); @@ -177,7 +179,7 @@ public class ProjectManager implements PropertyChangeListener { } Properties projectProperties = new Properties(); int projectIndex = 0; - for (Project project: projects) { + for (Project project : projects) { String projectPrefix = "projects." + projectIndex; projectProperties.setProperty(projectPrefix + ".id", project.getId()); projectProperties.setProperty(projectPrefix + ".name", project.getName()); @@ -187,7 +189,7 @@ public class ProjectManager implements PropertyChangeListener { projectProperties.setProperty(projectPrefix + ".basePath", project.getBasePath()); projectProperties.setProperty(projectPrefix + ".defaultFile", project.getDefaultFile()); int overrideIndex = 0; - for (Entry overrideEntry: project.getFileOverrides().entrySet()) { + for (Entry overrideEntry : project.getFileOverrides().entrySet()) { projectProperties.setProperty(projectPrefix + ".overrides." + overrideIndex + ".filePath", overrideEntry.getKey()); projectProperties.setProperty(projectPrefix + ".overrides." + overrideIndex + ".override", overrideEntry.getValue().toString()); overrideIndex++;