From 3eea4d97afc2fc667e42d64410be269d6959233d Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 13 Apr 2005 10:42:12 +0000 Subject: [PATCH] Use proper resource ordering for multiple type.properties files --- src/helma/framework/core/Prototype.java | 2 +- src/helma/util/ResourceProperties.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/helma/framework/core/Prototype.java b/src/helma/framework/core/Prototype.java index 7aa77a74..c5f6bd38 100644 --- a/src/helma/framework/core/Prototype.java +++ b/src/helma/framework/core/Prototype.java @@ -88,7 +88,7 @@ public final class Prototype { lowerCaseName = name.toLowerCase(); // Create and register type properties file - props = new ResourceProperties(); + props = new ResourceProperties(app); if (repository != null) { props.addResource(repository.getResource("type.properties")); } diff --git a/src/helma/util/ResourceProperties.java b/src/helma/util/ResourceProperties.java index 964f81cd..e87662fd 100644 --- a/src/helma/util/ResourceProperties.java +++ b/src/helma/util/ResourceProperties.java @@ -65,6 +65,14 @@ public final class ResourceProperties extends Properties { resources = new HashSet(); } + /** + * Constructs an empty ResourceProperties + * Resources must be added manually afterwards + */ + public ResourceProperties(Application app) { + resources = new TreeSet(app.getResourceComparator()); + } + /** * Constructs a ResourceProperties retrieving resources from the given * application using the given name to fetch resources @@ -159,7 +167,7 @@ public final class ResourceProperties extends Properties { /* next we try to load properties from the application's repositories, if we blong to any application */ - if (app != null) { + if (resourceName != null) { Iterator iterator = app.getRepositories().iterator(); while (iterator.hasNext()) { try { @@ -266,7 +274,7 @@ public final class ResourceProperties extends Properties { public long getChecksum() { long checksum = 0; - if (app != null) { + if (resourceName != null) { Iterator iterator = app.getRepositories().iterator(); while (iterator.hasNext()) { try {