You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/09/07 03:01:01 UTC

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler XmlOutputter.java

craigmcc    01/09/06 18:01:01

  Modified:    .        RELEASE-PLAN-4.0.txt
               jasper/src/share/org/apache/jasper/compiler
                        XmlOutputter.java
  Log:
  Fix bugs in the generation of the XML view of a JSP page that caused
  duplicate <jsp:root> elements (or attributes) under some circumstances.
  
  PR:  Bugzilla #3174 and 3351
  Submitted by:	Mark Abbot@openwave.com
  Reviewed by:	Kin-Man Chung <ki...@sun.com>
  
  Revision  Changes    Path
  1.8       +1 -9      jakarta-tomcat-4.0/RELEASE-PLAN-4.0.txt
  
  Index: RELEASE-PLAN-4.0.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/RELEASE-PLAN-4.0.txt,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RELEASE-PLAN-4.0.txt	2001/09/07 00:18:49	1.7
  +++ RELEASE-PLAN-4.0.txt	2001/09/07 01:01:01	1.8
  @@ -1,4 +1,4 @@
  -$Id: RELEASE-PLAN-4.0.txt,v 1.7 2001/09/07 00:18:49 craigmcc Exp $
  +$Id: RELEASE-PLAN-4.0.txt,v 1.8 2001/09/07 01:01:01 craigmcc Exp $
   
                         Release Plan for Apache Tomcat 4.0
                         ==================================
  @@ -66,17 +66,9 @@
   
   Jasper      3127    <jsp:directive.include/> not supported
   
  -Jasper      3174    XML view of JSP document is incorrect
  -
   Jasper      3235    JSPC command line compiler does not support taglibs
   
   Jasper      3350    Using XML syntax causes content rearrangement
  -
  -Jasper      3351    JSP documents in XML syntax produce invalid XML
  -
  -Jasper      3366    Character tag attributes
  -
  -Jasper      3381    Tag attributes of type short not working
   
   Jasper      3398    Jasper does not support primitive types for tag variables
   
  
  
  
  1.16      +10 -13    jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java
  
  Index: XmlOutputter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XmlOutputter.java	2001/07/25 01:49:10	1.15
  +++ XmlOutputter.java	2001/09/07 01:01:01	1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v 1.15 2001/07/25 01:49:10 craigmcc Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/07/25 01:49:10 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v 1.16 2001/09/07 01:01:01 craigmcc Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/09/07 01:01:01 $
    *
    * ====================================================================
    *
  @@ -94,7 +94,7 @@
       
       /*
        * Tells the nesting level of <jsp:root> tags encountered
  -     * in the translation unit.
  +     * in the translation unit.  This is currently unused.
        */
       private int jspRootLevel = 0;
   
  @@ -121,15 +121,16 @@
        * A translation unit (JSP source file and any files included via 
        * the include directive) may encounter multiple <jsp:root>
        * tags. This method cumulates all attributes for the
  -     * <jsp:root> tag.
  +     * <jsp:root> tag.  It also ignores any xmlns:jsp and version
  +     * attributes, in favor of the one generated by the compiler.
        */
       void addRootAttrs(Attributes attrs) {
   	jspRootLevel++;
           int attrsLength = attrs.getLength();
           for (int i = 0; i < attrsLength; i++) {
   	    String qName = attrs.getQName(i);
  -	    if (attrs.getQName(i).startsWith("xmlns:jsp") 
  -		&& jspRootLevel > 1) continue; 
  +            if ((qName.startsWith("xmlns:jsp") ||
  +                 qName.equals("version"))) continue;
               rootAttrs.addAttribute(attrs.getURI(i), attrs.getLocalName(i),
                   attrs.getQName(i), attrs.getType(i), attrs.getValue(i));
           }
  @@ -144,14 +145,11 @@
   
   
       /*
  -     * Only put the </jsp:root> tag when we're dealing
  -     * with the top level 'container' page.
  +     * Don't append the root end tag here because the
  +     * getPageData method will append it later.
        */
       void rootEnd() {
   	jspRootLevel--;
  -	if (jspRootLevel == 0) {
  -	    append("jsp:root");
  -	}
       }
       
       /**
  @@ -262,7 +260,6 @@
       PageData getPageData() {
   	StringBuffer buff = new StringBuffer();
           AttributesImpl attrs = new AttributesImpl();
  -
           
           append("jsp:root", rootAttrs, buff, false);
   	buff.append(sb.toString());