Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 60809 invoked by uid 500); 15 Apr 2003 13:05:38 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 60796 invoked from network); 15 Apr 2003 13:05:37 -0000 Received: from out001pub.verizon.net (HELO out001.verizon.net) (206.46.170.140) by daedalus.apache.org with SMTP; 15 Apr 2003 13:05:37 -0000 Received: from verizon.net ([139.85.116.117]) by out001.verizon.net (InterMail vM.5.01.05.27 201-253-122-126-127-20021220) with ESMTP id <20030415130538.XGTZ19613.out001.verizon.net@verizon.net> for ; Tue, 15 Apr 2003 08:05:38 -0500 Message-ID: <3E9C042A.6040900@verizon.net> Date: Tue, 15 Apr 2003 09:07:54 -0400 From: Vadim Gritsenko User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: cocoon-dev@xml.apache.org Subject: Re: Bug with context and subsitemaps References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Authentication-Info: Submitted using SMTP AUTH at out001.verizon.net from [139.85.116.117] at Tue, 15 Apr 2003 08:05:38 -0500 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Bj�rn L�tkemeier wrote: >Hi, > >we noticed a bug that occurs when working with nested subsitemaps. Lets have >a look at the following sitemap (I know its an abstract example, but I think >it is therefore easy to understand ;-)): > >sitemap: > > > > >sub/sitemap.xmap: > > > > > ... > > > >sub/sub/sitemap.xmap: > > > ... > > > >Now when you call http://.../cocoon/sub/sub/blah1 Cocoon will step down to >the sub/sub/sitemap, but find no match in it. Therefore it continues after >mount2 and executes pipeline **. Now the generator throws an exception >because file any.xml cannot be found. Why that? >The problem can be found within the code of class AbstractEnvironment: > >public void setContext(String prefix, String uri) { > this.setContext(getRootContext()); /* WRONG!!! */ > ... >} > >This method is called within class MountNode in the following way: > >String oldPrefix = env.getURIPrefix(); >String oldURI = env.getURI(); >try { > env.changeContext(resolvedPrefix, resolvedSource); > ... // process subsitemap >} finally { > // Restore context > env.setContext(oldPrefix, oldURI); > ... >} > >It is of cause wrong, because setContext() must not set the context to the >root context, which corresponds to the root sitemap, but to the one, that >has been active before changeContext(..). Therefore file any.xml will be >searched in the root directory, so its now clear why it cannot be found. > >We propose to add a method setContext(String prefix, String uri, URL >context) to interface Environment and perhaps to deprecate the old/wrong >one, so MountNode can reset the context correctly. > >Any comments / other ideas to fix the bug? > Seems that you are right in your findings. Carsten, can you comment? What really bugs me is that this is not the first time this particular bug is being fixed... Can you guys in addition to bug fix supply test class for this bug? Vadim