Hi, attached is the original mail from Volker about a bug in the SitemapSource. Can someone comment on this? Is it safe to apply the patch?
Carsten -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 25, 2003 12:11 PM To: [EMAIL PROTECTED] Subject: SitemapSource doesn't refresh correctly if subsitemaps are used, the refresh of a SitemapSource doesn't work correctly, because the Environment context isn't refreshed to the old value. If I change the code with the appended patch it works again. After the latest changes, I think the patch isn't the right way. I think the problem should be solved inside the MutableEnvironmentFacade.reset(), but I have not enaught time to investigate. Volker Index: SitemapSource.java =================================================================== RCS file: /home/cvspublic/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl /SitemapSource.java,v retrieving revision 1.10 diff -u -r1.10 SitemapSource.java --- SitemapSource.java 16 Aug 2003 13:30:04 -0000 1.10 +++ SitemapSource.java 25 Sep 2003 08:27:31 -0000 @@ -107,7 +107,7 @@ private String systemIdForCaching; /** The uri */ -// private String uri; + private String uri; /** The current ComponentManager */ private ComponentManager manager; @@ -122,7 +122,7 @@ private MutableEnvironmentFacade environment; /** The prefix for the processing */ -// private String prefix; + private String prefix; /** The <code>ProcessingPipeline</code> */ private ProcessingPipeline processingPipeline; @@ -161,11 +161,6 @@ this.manager = manager; this.enableLogging(logger); - - - - - boolean rawMode = false; // remove the protocol @@ -182,7 +177,7 @@ } // does the uri point to this sitemap or to the root sitemap? - String prefix; + //String prefix; if (uri.startsWith("//", position)) { position += 2; try { @@ -190,10 +185,10 @@ } catch (ComponentException e) { throw new MalformedURLException("Cannot get Processor instance"); } - prefix = ""; // start at the root + this.prefix = ""; // start at the root } else if (uri.startsWith("/", position)) { position ++; - prefix = null; + this.prefix = null; this.processor = CocoonComponentManager.getCurrentProcessor(); } else { throw new MalformedURLException("Malformed cocoon URI: " + uri); @@ -208,6 +203,7 @@ } else if (position > 0) { uri = uri.substring(position); } + this.uri = uri; // determine if the queryString specifies a cocoon-view String view = null; @@ -233,7 +229,7 @@ } // build the request uri which is relative to the context - String requestURI = (prefix == null ? env.getURIPrefix() + uri : uri); + String requestURI = (this.prefix == null ? env.getURIPrefix() + uri : uri); // create system ID this.systemId = queryString == null ? @@ -381,6 +377,7 @@ this.systemIdForCaching = this.systemId; try { this.processKey = CocoonComponentManager.startProcessing(this.environment); + this.environment.setURI(this.prefix, this.uri); //XXX this.processingPipeline = this.processor.buildPipeline(this.environment); this.pipelineProcessor = CocoonComponentManager.getLastProcessor(this.environment); this.environment.changeToLastContext();