Author: markt
Date: Mon Jan 13 13:49:31 2014
New Revision: 1557715
URL: http://svn.apache.org/r1557715
Log:
Back-port from XML processing improvements (part 9)
Switch JspDocumentParser to an DefaultHandler2
Back-port of http://svn.apache.org/r1547948
Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1557715&r1=1557714&r2=1557715&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jan 13 13:49:31 2014
@@ -61,13 +61,6 @@ PATCHES PROPOSED TO BACKPORT:
requires Ant >= 1.8.0).
-1:
-* Back-port from XML processing improvements (part 9)
- Switch JspDocumentParser to an DefaultHandler2
- Back-port of http://svn.apache.org/r1547948
-
http://people.apache.org/~markt/patches/2014-01-08-xml-prep-part9-tc6-v1.patch
- +1: markt, kkolinko, remm
- -1:
-
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55973
Fix processing of XML schemas when validation is enabled in Jasper
http://svn.apache.org/r1556377
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1557715&r1=1557714&r2=1557715&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
Mon Jan 13 13:49:31 2014
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,9 +39,8 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
-import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.ext.DefaultHandler2;
import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.DefaultHandler;
/**
* Class implementing a parser for a JSP document, that is, a JSP page in XML
@@ -52,8 +51,8 @@ import org.xml.sax.helpers.DefaultHandle
*/
class JspDocumentParser
- extends DefaultHandler
- implements LexicalHandler, TagConstants {
+ extends DefaultHandler2
+ implements TagConstants {
private static final String JSP_VERSION = "version";
private static final String LEXICAL_HANDLER_PROPERTY =
@@ -73,7 +72,7 @@ class JspDocumentParser
* Outermost (in the nesting hierarchy) node whose body is declared to be
* scriptless. If a node's body is declared to be scriptless, all its
* nested nodes must be scriptless, too.
- */
+ */
private Node scriptlessBodyNode;
private Locator locator;
@@ -240,11 +239,19 @@ class JspDocumentParser
}
}
+
+ @Override
+ public InputSource resolveEntity(String name, String publicId, String
baseURI, String systemId)
+ throws SAXException, IOException {
+ return null;
+ }
+
+
/*
* Receives notification of the start of an element.
*
* This method assigns the given tag attributes to one of 3 buckets:
- *
+ *
* - "xmlns" attributes that represent (standard or custom) tag libraries.
* - "xmlns" attributes that do not represent tag libraries.
* - all remaining attributes.
@@ -274,7 +281,7 @@ class JspDocumentParser
}
String currentPrefix = getPrefix(current.getQName());
-
+
// jsp:text must not have any subelements
if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName())
&& "jsp".equals(currentPrefix)) {
@@ -289,7 +296,7 @@ class JspDocumentParser
if (attrs != null) {
/*
* Notice that due to a bug in the underlying SAX parser, the
- * attributes must be enumerated in descending order.
+ * attributes must be enumerated in descending order.
*/
boolean isTaglib = false;
for (int i = attrs.getLength() - 1; i >= 0; i--) {
@@ -441,7 +448,7 @@ class JspDocumentParser
* invoke this method with chunks of it. This is a problem when we try
* to determine if the text contains only whitespaces, or when we are
* looking for an EL expression string. Therefore it is necessary to
- * buffer and concatenate the chunks and process the concatenated text
+ * buffer and concatenate the chunks and process the concatenated text
* later (at beginTag and endTag)
*
* @param buf The characters
@@ -671,7 +678,7 @@ class JspDocumentParser
if (!(child instanceof
Node.NamedAttribute)) {
throw new
SAXParseException(Localizer.getMessage(
"jasper.error.emptybodycontent.nonempty",
- current.qName),
locator);
+ current.qName),
locator);
}
}
}
@@ -776,7 +783,7 @@ class JspDocumentParser
}
/*
- * Receives notification of the start of a Namespace mapping.
+ * Receives notification of the start of a Namespace mapping.
*/
public void startPrefixMapping(String prefix, String uri)
throws SAXException {
@@ -785,7 +792,7 @@ class JspDocumentParser
if (directivesOnly && !(JSP_URI.equals(uri))) {
return;
}
-
+
try {
taglibInfo = getTaglibInfo(prefix, uri);
} catch (JasperException je) {
@@ -806,7 +813,7 @@ class JspDocumentParser
}
/*
- * Receives notification of the end of a Namespace mapping.
+ * Receives notification of the end of a Namespace mapping.
*/
public void endPrefixMapping(String prefix) throws SAXException {
@@ -1432,7 +1439,7 @@ class JspDocumentParser
"http://apache.org/xml/features/validation/schema",
true);
}
-
+
// Configure the parser
SAXParser saxParser = factory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]