tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r654640 - /tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
Date Thu, 08 May 2008 21:53:37 GMT
Author: markt
Date: Thu May  8 14:53:35 2008
New Revision: 654640

URL: http://svn.apache.org/viewvc?rev=654640&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42943
Make sure the nested element is inside a <jsp:text> element

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=654640&r1=654639&r2=654640&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Thu May  8 14:53:35
2008
@@ -278,8 +278,11 @@
             return;
         }
 
+        String currentPrefix = getPrefix(current.getQName());
+        
         // jsp:text must not have any subelements
-        if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName())) {
+        if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName())
+                && "jsp".equals(currentPrefix)) {
             throw new SAXParseException(
                 Localizer.getMessage("jsp.error.text.has_subelement"),
                 locator);
@@ -1175,11 +1178,7 @@
             }
         }
 
-        String prefix = "";
-        int colon = qName.indexOf(':');
-        if (colon != -1) {
-            prefix = qName.substring(0, colon);
-        }
+        String prefix = getPrefix(qName);
 
         Node.CustomTag ret = null;
         if (tagInfo != null) {
@@ -1366,9 +1365,8 @@
      */
     private void checkPrefix(String uri, String qName) {
 
-        int index = qName.indexOf(':');
-        if (index != -1) {
-            String prefix = qName.substring(0, index);
+        String prefix = getPrefix(qName);
+        if (prefix.length() > 0) {
             pageInfo.addPrefix(prefix);
             if ("jsp".equals(prefix) && !JSP_URI.equals(uri)) {
                 pageInfo.setIsJspPrefixHijacked(true);
@@ -1376,6 +1374,14 @@
         }
     }
 
+    private String getPrefix(String qName) {
+        int index = qName.indexOf(':');
+        if (index != -1) {
+            return qName.substring(0, index);
+        }
+        return "";
+    }
+
     /*
      * Gets SAXParser.
      *



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message