I don't think this patch is correct.  The order that the methods
startPrefixMapping and endPrefixMapping are called is properly nested,
so a stack is appropiate.  Take for instance the follow xml fragment

1 <foo xmlns:my="mytaglib">     <!-- namespace for my taglib -->
2    <bar xmlns:my="nottaglib"/> <!-- this namesapce is not a taglib -->
3    <my:doThat/>               <!-- Is this a taglib invokation? -->
4 </foo>

The order that those methods will be called is:

At line 1: startPrefixMapping("my", "mytaglib")
At line 2: startPrefixMapping("my", "nottaglib")
At line 2: endPrefixMapping("my")       # for nottaglib
At line 4: endPrefixMapping("my")       # for mytaglib

According to your patch, pageInfo.popPrefixMapping() will be called
resulting in Line 3 above not being interpreted as a tag handler
invokation.

This probably does not matter, as I simplify the logic here and remove
the stack altogeterh.

-Kin-man

> Date: Sat, 09 Aug 2003 14:55:46 +0000
> From: [EMAIL PROTECTED]
> Subject: cvs commit: 
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler 
JspDocumentParser.java
> To: [EMAIL PROTECTED]
> 
> remm        2003/08/09 07:55:46
> 
>   Modified:    jasper2/src/share/org/apache/jasper/compiler
>                         JspDocumentParser.java
>   Log:
>   - pop is called in the same order as push, so using a stack is not correct.
>     A linked list should be used instead.
>   
>   Revision  Changes    Path
>   1.63      +9 -10     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentPa
rser.java
>   
>   Index: JspDocumentParser.java
>   ===================================================================
>   RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Jsp
DocumentParser.java,v
>   retrieving revision 1.62
>   retrieving revision 1.63
>   diff -u -r1.62 -r1.63
>   --- JspDocumentParser.java  8 Aug 2003 22:22:09 -0000       1.62
>   +++ JspDocumentParser.java  9 Aug 2003 14:55:46 -0000       1.63
>   @@ -109,7 +109,7 @@
>        private boolean isTagFile;
>        private boolean directivesOnly;
>        private boolean isTop;
>   -    private Stack prefixMapStack;
>   +    private LinkedList prefixMapLinkedList;
>    
>        /*
>         * Constructor
>   @@ -128,7 +128,7 @@
>       this.isTagFile = isTagFile;
>       this.directivesOnly = directivesOnly;
>       this.isTop = true;
>   -        this.prefixMapStack = new Stack();;
>   +        this.prefixMapLinkedList = new LinkedList();;
>        }
>    
>        /*
>   @@ -560,10 +560,9 @@
>            if (taglibInfo != null) {
>                pageInfo.addTaglib(uri, taglibInfo);
>                pageInfo.pushPrefixMapping(prefix, uri);
>   -            prefixMapStack.push(new Boolean(true));
>   -   }
>   -        else {
>   -            prefixMapStack.push(new Boolean(false));
>   +            prefixMapLinkedList.addLast(new Boolean(true));
>   +        } else {
>   +            prefixMapLinkedList.addLast(new Boolean(false));
>            }
>         }
>    
>   @@ -571,7 +570,7 @@
>          * Receives notification of the end of a Namespace mapping. 
>          */
>        public void endPrefixMapping(String prefix) throws SAXException {
>   -        if (((Boolean)prefixMapStack.pop()).booleanValue()) {
>   +        if (((Boolean) prefixMapLinkedList.removeFirst()).booleanValue()) {
>                pageInfo.popPrefixMapping(prefix);
>            }
>        }
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to