cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Hofmann <Johannes.Hofm...@gmx.de>
Subject AbstractComplementaryConfigurableAction
Date Thu, 26 Jul 2001 09:31:10 GMT
I just looked at the source of AbstractComplementaryConfigurableAction.java.
Is the descriptor unique in the whole JVM?
I think one should use resource.getSystemId() instead as key in the configurations map, as
descriptor might be a relative path or somthing similar.

BTW: I really like C2!

Cheers,
Johannes Hofmann



Possible patch:


--- AbstractComplementaryConfigurableAction.java.orig	Thu Jul 26 11:12:41 2001
+++ AbstractComplementaryConfigurableAction.java	Thu Jul 26 11:17:52 2001
@@ -66,16 +66,16 @@
         }
 
         synchronized (AbstractComplementaryConfigurableAction.configurations) {
-            conf = (ConfigurationHelper) AbstractComplementaryConfigurableAction.configurations.get(descriptor);
-
-            if (reloadable || conf == null) {
-                SourceHandler sourceHandler = null;
-                Source resource = null;
-
-                try {
-                    sourceHandler = (SourceHandler) this.manager.lookup(SourceHandler.ROLE);
-                    resource = sourceHandler.getSource(null, descriptor);
+	    SourceHandler sourceHandler = null;
+	    Source resource = null;
+	    
+	    try {
+		sourceHandler = (SourceHandler) this.manager.lookup(SourceHandler.ROLE);
+		resource = sourceHandler.getSource(null, descriptor);
+		
+		conf = (ConfigurationHelper) AbstractComplementaryConfigurableAction.configurations.get(resource.getSystemId());
 
+		if (reloadable || conf == null) {
 		    if (conf == null || conf.lastModified < resource.getLastModified()) {
 			getLogger().debug("(Re)Loading " + descriptor);
 			if (conf == null) 
@@ -87,18 +87,16 @@
 			conf.lastModified = resource.getLastModified();
 			conf.configuration = builder.getConfiguration();
 			
-			this.cacheConfiguration(descriptor, conf);
+			this.cacheConfiguration(resource.getSystemId(), conf);
 		    } else {
 			getLogger().debug("Using cached configuration for " + descriptor);
 		    }
-		} catch (Exception e) {
+		}
+	    } catch (Exception e) {
 		    getLogger().error("Could not configure Database mapping environment", e);
                     throw new ConfigurationException("Error trying to load configurations
for resource: " + (resource == null ? "null" : resource.getSystemId()));
-                } finally {
+	    } finally {
                     if (sourceHandler != null) this.manager.release((Component) sourceHandler);
-		}
-	    } else {
-		getLogger().debug("Using fixed cached configuration for " + descriptor);
 	    }
         }
 	

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message