Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47318
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 5 Jun 2009 23:35:14 +0000 (23:35 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 5 Jun 2009 23:35:14 +0000 (23:35 +0000)
Process include preludes and codas when processing directives and whole pages.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@782166 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Parser.java

index 87a29dc..30dd994 100644 (file)
@@ -124,25 +124,24 @@ class Parser implements TagConstants {
         root.setIsDefaultPageEncoding(isDefaultPageEncoding);
         root.setIsBomPresent(isBomPresent);
 
-        if (directivesOnly) {
-            parser.parseTagFileDirectives(root);
-            return new Node.Nodes(root);
-        }
 
-        // For the Top level page, add inlcude-prelude and include-coda
+        // For the Top level page, add include-prelude and include-coda
         PageInfo pageInfo = pc.getCompiler().getPageInfo();
         if (parent == null) {
             parser.addInclude(root, pageInfo.getIncludePrelude());
         }
-        while (reader.hasMoreInput()) {
-            parser.parseElements(root);
+        if (directivesOnly) {
+            parser.parseTagFileDirectives(root);
+        } else {
+            while (reader.hasMoreInput()) {
+                parser.parseElements(root);
+            }
         }
         if (parent == null) {
             parser.addInclude(root, pageInfo.getIncludeCoda());
         }
 
-        Node.Nodes page = new Node.Nodes(root);
-        return page;
+        return new Node.Nodes(root);
     }
 
     /**