luehe       2003/01/10 16:51:36

  Modified:    jasper2/src/share/org/apache/jasper/compiler Parser.java
  Log:
  Fixed 15966: Jasper parser is incorrectly handling empty jsp:body elements
  
  Revision  Changes    Path
  1.55      +11 -29    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- Parser.java       11 Jan 2003 00:11:06 -0000      1.54
  +++ Parser.java       11 Jan 2003 00:51:36 -0000      1.55
  @@ -1597,38 +1597,20 @@
       }
   
       /*
  -     * JspBodyBody ::=      ( S? '>' 
  -     *                        ( (   ScriptlessBody 
  -     *                            | Body
  -     *                            | TagDependentBody
  -     *                          ) - ''
  -     *                        ) '</jsp:body>' 
  -     *                      )
  -     *                  |   ( ATTR[ !value ] S? JspBodyEmptyBody )
  -     *
  -     * JspBodyEmptyBody ::=     '/>'
  -     *                      |   '></jsp:body>'
  -     *                      |   <TRANSLATION_ERROR>
  -     *
  +     * Parses jsp:body action.
        */
       private void parseJspBody(Node parent, String bodyType) 
           throws JasperException 
       {
           Mark start = reader.mark();
  -        reader.skipSpaces();
  -
  -        if (!reader.matches(">")) {
  -         err.jspError(reader.mark(),
  -                      "jsp.error.attributes.not.allowed",
  -                      "&lt;jsp:body&gt;" );
  -     }
  -
        Node bodyNode = new Node.JspBody(start, parent);
  -     if( reader.matches( "</jsp:body>" ) ) {
  -         // Body was empty.  This is illegal, according to the grammar.
  -         err.jspError(reader.mark(),"jsp.error.empty.body.not.allowed",
  -                      "&lt;jsp:body&gt;" );
  -     } else {
  +
  +     reader.skipSpaces();
  +     if (!reader.matches("/>")) {
  +         if (!reader.matches(">")) {
  +             err.jspError(start, "jsp.error.unterminated",
  +                          "&lt;jsp:body");
  +         }
            parseBody( bodyNode, "jsp:body", bodyType );
        }
       }
  
  
  

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

Reply via email to