From d6015942121ba0e43177da20c3559126e9c6dafe Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 2 Jun 2008 13:20:27 +0200 Subject: [PATCH] fix loading of overrides --- src/net/pterodactylus/jsite/project/ProjectManager.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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++; -- 2.7.4