fix loading of overrides
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 2 Jun 2008 11:20:27 +0000 (13:20 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 2 Jun 2008 11:20:27 +0000 (13:20 +0200)
src/net/pterodactylus/jsite/project/ProjectManager.java

index 8f1cb8a..35436ca 100644 (file)
@@ -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<String, FileOverride> overrideEntry: project.getFileOverrides().entrySet()) {
+                       for (Entry<String, FileOverride> overrideEntry : project.getFileOverrides().entrySet()) {
                                projectProperties.setProperty(projectPrefix + ".overrides." + overrideIndex + ".filePath", overrideEntry.getKey());
                                projectProperties.setProperty(projectPrefix + ".overrides." + overrideIndex + ".override", overrideEntry.getValue().toString());
                                overrideIndex++;