Author: markt Date: Mon Jan 13 13:38:05 2014 New Revision: 1557710 URL: http://svn.apache.org/r1557710 Log: Back-port from XML processing improvements (part 6) Upgrade digester to use DefaultHandler2 and use LexicalHandler to detect publicId. Simplify web application version detection in web.xml Extracted from a patch by Jeremy Boynes. Essentially, this is a back-port of http://svn.apache.org/r1547931 Note that the patch contains a number of strictly unnecessary cosmetic changes that have been included to make it simpler to compare the resulting Tomcat 6 code with the current Tomcat 7 code to validate the correctness of the back-port
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/digester/Digester.java Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1557710&r1=1557709&r2=1557710&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jan 13 13:38:05 2014 @@ -61,22 +61,6 @@ PATCHES PROPOSED TO BACKPORT: requires Ant >= 1.8.0). -1: -* Back-port from XML processing improvements (part 6) - Upgrade digester to use DefaultHandler2 and use LexicalHandler to detect - publicId. - Simplify web application version detection in web.xml - Extracted from a patch by Jeremy Boynes. - Essentially, this is a back-port of http://svn.apache.org/r1547931 - Note that the patch contains a number of strictly unnecessary cosmetic changes - that have been included to make it simpler to compare the resulting Tomcat 6 - code with the current Tomcat 7 code to validate the correctness of the - back-port - http://people.apache.org/~markt/patches/2014-01-08-xml-prep-part6-tc6-v1.patch - +1: markt, kkolinko, remm - -1: - kkolinko: It would be easier to review without all those trailing - whitespace changes. - * Back-port from XML processing improvements (part 7) Switch o.a.catalina classes to use the new ErrorHandler Back-port of http://svn.apache.org/r1547937 Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1557710&r1=1557709&r2=1557710&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Mon Jan 13 13:38:05 2014 @@ -101,6 +101,7 @@ import org.apache.naming.resources.DirCo import org.apache.naming.resources.FileDirContext; import org.apache.naming.resources.ProxyDirContext; import org.apache.naming.resources.WARDirContext; +import org.apache.tomcat.util.descriptor.XmlIdentifiers; import org.apache.tomcat.util.modeler.Registry; /** @@ -5049,15 +5050,7 @@ public class StandardContext * Are we processing a version 2.2 deployment descriptor? */ protected boolean isServlet22() { - - if (this.publicId == null) - return (false); - if (this.publicId.equals - (org.apache.catalina.startup.Constants.WebDtdPublicId_22)) - return (true); - else - return (false); - + return XmlIdentifiers.WEB_22_PUBLIC.equals(publicId); } @@ -5888,7 +5881,7 @@ public class StandardContext public void setTldNamespaceAware(boolean tldNamespaceAware){ // NO-OP; - } + } public void setTldValidation(boolean tldValidation){ Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/digester/Digester.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/digester/Digester.java?rev=1557710&r1=1557709&r2=1557710&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/digester/Digester.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/digester/Digester.java Mon Jan 13 13:38:05 2014 @@ -5,15 +5,15 @@ * 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. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.apache.tomcat.util.digester; @@ -24,6 +24,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.EmptyStackException; import java.util.HashMap; import java.util.Iterator; @@ -48,10 +50,8 @@ import org.xml.sax.SAXNotRecognizedExcep import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; +import org.xml.sax.ext.DefaultHandler2; import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.DefaultHandler; - - /** @@ -73,19 +73,18 @@ import org.xml.sax.helpers.DefaultHandle * the support of XML schema. You need Xerces 2.1/2.3 and up to make * this class working with XML schema</p> */ - -public class Digester extends DefaultHandler { +public class Digester extends DefaultHandler2 { // ---------------------------------------------------------- Static Fields - private static class SystemPropertySource + private static class SystemPropertySource implements IntrospectionUtils.PropertySource { public String getProperty( String key ) { return System.getProperty(key); } } - protected static IntrospectionUtils.PropertySource source[] = + protected static IntrospectionUtils.PropertySource source[] = new IntrospectionUtils.PropertySource[] { new SystemPropertySource() }; @@ -155,12 +154,12 @@ public class Digester extends DefaultHan * in the input is entered, the matching rules are pushed onto this * stack. After the end tag is reached, the matches are popped again. * The depth of is stack is therefore exactly the same as the current - * "nesting" level of the input xml. + * "nesting" level of the input xml. * * @since 1.6 */ protected ArrayStack matches = new ArrayStack(10); - + /** * The class loader to use for instantiating application objects. * If not specified, the context class loader, or the class loader @@ -180,7 +179,7 @@ public class Digester extends DefaultHan * The EntityResolver used by the SAX parser. By default it use this class */ protected EntityResolver entityResolver; - + /** * The URLs of entityValidator that have been registered, keyed by the public * identifier that corresponds. @@ -205,8 +204,8 @@ public class Digester extends DefaultHan */ protected String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; - - + + /** * The Locator associated with our parser. */ @@ -282,14 +281,14 @@ public class Digester extends DefaultHan * default this value is set to <code>W3C_XML_SCHEMA</code> */ protected String schemaLanguage = W3C_XML_SCHEMA; - - + + /** * The XML schema to use for validating an XML instance. */ protected String schemaLocation = null; - - + + /** * The object stack being constructed. */ @@ -309,13 +308,12 @@ public class Digester extends DefaultHan protected boolean validating = false; - /** * Warn on missing attributes and elements. */ protected boolean rulesValidation = false; - + /** * Fake attributes map (attributes are often used for object creation). */ @@ -334,17 +332,17 @@ public class Digester extends DefaultHan */ protected Log saxLog = LogFactory.getLog("org.apache.tomcat.util.digester.Digester.sax"); - - + + /** * The schema language supported. By default, we use this one. */ protected static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; - + /** Stacks used for interrule communication, indexed by name String */ private HashMap stacksByName = new HashMap(); - + // ------------------------------------------------------------- Properties /** @@ -355,7 +353,7 @@ public class Digester extends DefaultHan * @param prefix Prefix to look up */ public String findNamespaceURI(String prefix) { - + ArrayStack stack = (ArrayStack) namespaces.get(prefix); if (stack == null) { return (null); @@ -488,9 +486,9 @@ public class Digester extends DefaultHan /** * Return the SAXParserFactory we will use, creating one if necessary. - * @throws ParserConfigurationException - * @throws SAXNotSupportedException - * @throws SAXNotRecognizedException + * @throws ParserConfigurationException + * @throws SAXNotSupportedException + * @throws SAXNotRecognizedException */ public SAXParserFactory getFactory() throws SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationException { @@ -603,10 +601,10 @@ public class Digester extends DefaultHan * @since 1.6 */ public Log getSAXLogger() { - + return saxLog; } - + /** * Sets the logger used for logging SAX-related information. @@ -614,9 +612,9 @@ public class Digester extends DefaultHan * @param saxLog Log, not null * * @since 1.6 - */ + */ public void setSAXLogger(Log saxLog) { - + this.saxLog = saxLog; } @@ -651,7 +649,7 @@ public class Digester extends DefaultHan } - + /** * Set the public id of the current file being parse. * @param publicId the DTD/Schema public's id. @@ -659,8 +657,8 @@ public class Digester extends DefaultHan public void setPublicId(String publicId){ this.publicId = publicId; } - - + + /** * Return the public identifier of the DTD we are currently * parsing under, if any. @@ -778,7 +776,7 @@ public class Digester extends DefaultHan /** * By setting the reader in the constructor, you can bypass JAXP and - * be able to use digester in Weblogic 6.0. + * be able to use digester in Weblogic 6.0. * * @deprecated Use getXMLReader() instead, which can throw a * SAXException if the reader cannot be instantiated @@ -810,7 +808,7 @@ public class Digester extends DefaultHan } - + /** * Set the <code>Rules</code> implementation object containing our * rules collection and associated matching policy. @@ -844,8 +842,8 @@ public class Digester extends DefaultHan this.schemaLocation = schemaLocation; - } - + } + /** * Return the XML Schema language used when parsing. @@ -866,7 +864,7 @@ public class Digester extends DefaultHan this.schemaLanguage = schemaLanguage; - } + } /** @@ -987,24 +985,27 @@ public class Digester extends DefaultHan /** * Return the XMLReader to be used for parsing the input document. * - * FIX ME: there is a bug in JAXP/XERCES that prevent the use of a + * FIX ME: there is a bug in JAXP/XERCES that prevent the use of a * parser that contains a schema with a DTD. * @exception SAXException if no XMLReader can be instantiated */ public XMLReader getXMLReader() throws SAXException { if (reader == null){ reader = getParser().getXMLReader(); - } - - reader.setDTDHandler(this); - reader.setContentHandler(this); - + } + + reader.setDTDHandler(this); + reader.setContentHandler(this); + if (entityResolver == null){ reader.setEntityResolver(this); } else { - reader.setEntityResolver(entityResolver); + reader.setEntityResolver(entityResolver); } - + + reader.setProperty( + "http://xml.org/sax/properties/lexical-handler", this); + reader.setErrorHandler(this); return reader; } @@ -1104,7 +1105,7 @@ public class Digester extends DefaultHan // Parse system properties bodyText = updateBodyText(bodyText); - // the actual element name is either in localName or qName, depending + // the actual element name is either in localName or qName, depending // on whether the parser is namespace aware String name = localName; if ((name == null) || (name.length() < 1)) { @@ -1304,7 +1305,7 @@ public class Digester extends DefaultHan saxLog.debug("startDocument()"); } - // ensure that the digester is properly configured, as + // ensure that the digester is properly configured, as // the digester could be used as a SAX ContentHandler // rather than via the parse() methods. configure(); @@ -1321,22 +1322,22 @@ public class Digester extends DefaultHan * @param qName The qualified name (with prefix), or the empty * string if qualified names are not available.\ * @param list The attributes attached to the element. If there are - * no attributes, it shall be an empty Attributes object. + * no attributes, it shall be an empty Attributes object. * @exception SAXException if a parsing error is to be reported */ public void startElement(String namespaceURI, String localName, String qName, Attributes list) throws SAXException { boolean debug = log.isDebugEnabled(); - + if (saxLog.isDebugEnabled()) { saxLog.debug("startElement(" + namespaceURI + "," + localName + "," + qName + ")"); } - + // Parse system properties list = updateAttributes(list); - + // Save the body text accumulated for our surrounding element bodyTexts.push(bodyText); if (debug) { @@ -1344,7 +1345,7 @@ public class Digester extends DefaultHan } bodyText = new StringBuffer(); - // the actual element name is either in localName or qName, depending + // the actual element name is either in localName or qName, depending // on whether the parser is namespace aware String name = localName; if ((name == null) || (name.length() < 1)) { @@ -1466,8 +1467,8 @@ public class Digester extends DefaultHan public void setEntityResolver(EntityResolver entityResolver){ this.entityResolver = entityResolver; } - - + + /** * Return the Entity Resolver used by the SAX parser. * @return Return the Entity Resolver used by the SAX parser. @@ -1476,58 +1477,63 @@ public class Digester extends DefaultHan return entityResolver; } - /** - * Resolve the requested external entity. - * - * @param publicId The public identifier of the entity being referenced - * @param systemId The system identifier of the entity being referenced - * - * @exception SAXException if a parsing exception occurs - * - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException { - + @Override + public InputSource resolveEntity(String name, String publicId, + String baseURI, String systemId) throws SAXException, IOException { + if (saxLog.isDebugEnabled()) { - saxLog.debug("resolveEntity('" + publicId + "', '" + systemId + "')"); + saxLog.debug("resolveEntity('" + publicId + "', '" + systemId + + "', '" + baseURI + "')"); } - - if (publicId != null) - this.publicId = publicId; - + // Has this system identifier been registered? String entityURL = null; if (publicId != null) { entityURL = (String) entityValidator.get(publicId); } - + // Redirect the schema location to a local destination if (schemaLocation != null && entityURL == null && systemId != null){ entityURL = (String)entityValidator.get(systemId); - } + } - if (entityURL == null) { + if (entityURL == null) { if (systemId == null) { // cannot resolve if (log.isDebugEnabled()) { log.debug(" Cannot resolve entity: '" + entityURL + "'"); } return (null); - + } else { // try to resolve using system ID if (log.isDebugEnabled()) { - log.debug(" Trying to resolve using system ID '" + systemId + "'"); - } + log.debug(" Trying to resolve using system ID '" + + systemId + "'"); + } entityURL = systemId; + // resolve systemId against baseURI if it is not absolute + if (baseURI != null) { + try { + URI uri = new URI(systemId); + if (!uri.isAbsolute()) { + entityURL = new URI(baseURI).resolve(uri).toString(); + } + } catch (URISyntaxException e) { + if (log.isDebugEnabled()) { + log.debug("Invalid URI '" + baseURI + "' or '" + + systemId + "'"); + } + } + } } } - + // Return an input source to our alternative URL if (log.isDebugEnabled()) { log.debug(" Resolving to alternate DTD '" + entityURL + "'"); - } - + } + try { return (new InputSource(entityURL)); } catch (Exception e) { @@ -1536,8 +1542,16 @@ public class Digester extends DefaultHan } - // ------------------------------------------------- ErrorHandler Methods + // ----------------------------------------------- LexicalHandler Methods + + @Override + public void startDTD(String name, String publicId, String systemId) + throws SAXException { + setPublicId(publicId); + } + + // ------------------------------------------------- ErrorHandler Methods /** * Forward notification of a parsing error to the application supplied @@ -1592,7 +1606,7 @@ public class Digester extends DefaultHan log.warn("Parse Warning Error at line " + exception.getLineNumber() + " column " + exception.getColumnNumber() + ": " + exception.getMessage(), exception); - + errorHandler.warning(exception); } @@ -1645,7 +1659,7 @@ public class Digester extends DefaultHan getXMLReader().parse(input); return (root); - } + } /** * Parse the content of the specified input source using this Digester. * Returns the root element from the object stack (if any). @@ -1656,7 +1670,7 @@ public class Digester extends DefaultHan * @exception SAXException if a parsing exception occurs */ public Object parse(InputSource input) throws IOException, SAXException { - + configure(); getXMLReader().parse(input); return (root); @@ -1726,18 +1740,18 @@ public class Digester extends DefaultHan * This must be called before the first call to <code>parse()</code>. * </p><p> * <code>Digester</code> contains an internal <code>EntityResolver</code> - * implementation. This maps <code>PUBLICID</code>'s to URLs + * implementation. This maps <code>PUBLICID</code>'s to URLs * (from which the resource will be loaded). A common use case for this - * method is to register local URLs (possibly computed at runtime by a + * method is to register local URLs (possibly computed at runtime by a * classloader) for DTDs. This allows the performance advantage of using * a local version without having to ensure every <code>SYSTEM</code> * URI on every processed xml document is local. This implementation provides * only basic functionality. If more sophisticated features are required, * using {@link #setEntityResolver} to set a custom resolver is recommended. * </p><p> - * <strong>Note:</strong> This method will have no effect when a custom - * <code>EntityResolver</code> has been set. (Setting a custom - * <code>EntityResolver</code> overrides the internal implementation.) + * <strong>Note:</strong> This method will have no effect when a custom + * <code>EntityResolver</code> has been set. (Setting a custom + * <code>EntityResolver</code> overrides the internal implementation.) * </p> * @param publicId Public identifier of the DTD to be resolved * @param entityURL The URL to use for reading this DTD @@ -1850,7 +1864,7 @@ public class Digester extends DefaultHan addRule(pattern, new CallMethodRule( methodName, - paramCount, + paramCount, paramTypes)); } @@ -1879,7 +1893,7 @@ public class Digester extends DefaultHan addRule(pattern, new CallMethodRule( methodName, - paramCount, + paramCount, paramTypes)); } @@ -1922,18 +1936,18 @@ public class Digester extends DefaultHan /** * Add a "call parameter" rule. - * This will either take a parameter from the stack - * or from the current element body text. + * This will either take a parameter from the stack + * or from the current element body text. * * @param paramIndex The zero-relative parameter number * @param fromStack Should the call parameter be taken from the top of the stack? * @see CallParamRule - */ + */ public void addCallParam(String pattern, int paramIndex, boolean fromStack) { - + addRule(pattern, new CallParamRule(paramIndex, fromStack)); - + } /** @@ -1944,16 +1958,16 @@ public class Digester extends DefaultHan * @param stackIndex set the call parameter to the stackIndex'th object down the stack, * where 0 is the top of the stack, 1 the next element down and so on * @see CallMethodRule - */ + */ public void addCallParam(String pattern, int paramIndex, int stackIndex) { - + addRule(pattern, new CallParamRule(paramIndex, stackIndex)); - + } - + /** - * Add a "call parameter" rule that sets a parameter from the current + * Add a "call parameter" rule that sets a parameter from the current * <code>Digester</code> matching path. * This is sometimes useful when using rules that support wildcards. * @@ -1964,9 +1978,9 @@ public class Digester extends DefaultHan public void addCallParamPath(String pattern,int paramIndex) { addRule(pattern, new PathCallParamRule(paramIndex)); } - + /** - * Add a "call parameter" rule that sets a parameter from a + * Add a "call parameter" rule that sets a parameter from a * caller-provided object. This can be used to pass constants such as * strings to methods; it can also be used to pass mutable objects, * providing ways for objects to do things like "register" themselves @@ -1984,15 +1998,15 @@ public class Digester extends DefaultHan * @see CallMethodRule * * @since 1.6 - */ - public void addObjectParam(String pattern, int paramIndex, + */ + public void addObjectParam(String pattern, int paramIndex, Object paramObj) { - + addRule(pattern, new ObjectParamRule(paramIndex, paramObj)); - + } - + /** * Add a "factory create" rule for the specified parameters. * Exceptions thrown during the object creation process will be propagated. @@ -2085,7 +2099,7 @@ public class Digester extends DefaultHan * @see FactoryCreateRule */ public void addFactoryCreate( - String pattern, + String pattern, String className, boolean ignoreCreateExceptions) { @@ -2106,7 +2120,7 @@ public class Digester extends DefaultHan * @see FactoryCreateRule */ public void addFactoryCreate( - String pattern, + String pattern, Class clazz, boolean ignoreCreateExceptions) { @@ -2129,7 +2143,7 @@ public class Digester extends DefaultHan * @see FactoryCreateRule */ public void addFactoryCreate( - String pattern, + String pattern, String className, String attributeName, boolean ignoreCreateExceptions) { @@ -2153,7 +2167,7 @@ public class Digester extends DefaultHan * @see FactoryCreateRule */ public void addFactoryCreate( - String pattern, + String pattern, Class clazz, String attributeName, boolean ignoreCreateExceptions) { @@ -2340,7 +2354,7 @@ public class Digester extends DefaultHan * @see SetPropertiesRule */ public void addSetProperties( - String pattern, + String pattern, String attributeName, String propertyName) { @@ -2359,7 +2373,7 @@ public class Digester extends DefaultHan * @see SetPropertiesRule */ public void addSetProperties( - String pattern, + String pattern, String [] attributeNames, String [] propertyNames) { @@ -2427,7 +2441,7 @@ public class Digester extends DefaultHan * Clear the current contents of the object stack. * <p> * Calling this method <i>might</i> allow another document of the same type - * to be correctly parsed. However this method was not intended for this + * to be correctly parsed. However this method was not intended for this * purpose. In general, a separate Digester object should be created for * each document to be parsed. */ @@ -2441,10 +2455,10 @@ public class Digester extends DefaultHan log = null; saxLog = null; configured = false; - + } - + public void reset() { root = null; setErrorHandler(null); @@ -2521,7 +2535,7 @@ public class Digester extends DefaultHan /** * Pushes the given object onto the stack with the given name. * If no stack already exists with the given name then one will be created. - * + * * @param stackName the name of the stack onto which the object should be pushed * @param value the Object to be pushed onto the named stack. * @@ -2541,9 +2555,9 @@ public class Digester extends DefaultHan * * <p><strong>Note:</strong> a stack is considered empty * if no objects have been pushed onto it yet.</p> - * + * * @param stackName the name of the stack from which the top value is to be popped - * @return the top <code>Object</code> on the stack or or null if the stack is either + * @return the top <code>Object</code> on the stack or or null if the stack is either * empty or has not been created yet * @throws EmptyStackException if the named stack is empty * @@ -2557,14 +2571,14 @@ public class Digester extends DefaultHan log.debug("Stack '" + stackName + "' is empty"); } throw new EmptyStackException(); - + } else { - + result = namedStack.pop(); } return result; } - + /** * <p>Gets the top object from the stack with the given name. * This method does not remove the object from the stack. @@ -2573,9 +2587,9 @@ public class Digester extends DefaultHan * if no objects have been pushed onto it yet.</p> * * @param stackName the name of the stack to be peeked - * @return the top <code>Object</code> on the stack or null if the stack is either + * @return the top <code>Object</code> on the stack or null if the stack is either * empty or has not been created yet - * @throws EmptyStackException if the named stack is empty + * @throws EmptyStackException if the named stack is empty * * @since 1.6 */ @@ -2585,11 +2599,11 @@ public class Digester extends DefaultHan if (namedStack == null ) { if (log.isDebugEnabled()) { log.debug("Stack '" + stackName + "' is empty"); - } + } throw new EmptyStackException(); - + } else { - + result = namedStack.peek(); } return result; @@ -2599,9 +2613,9 @@ public class Digester extends DefaultHan * <p>Is the stack with the given name empty?</p> * <p><strong>Note:</strong> a stack is considered empty * if no objects have been pushed onto it yet.</p> - * @param stackName the name of the stack whose emptiness + * @param stackName the name of the stack whose emptiness * should be evaluated - * @return true if the given stack if empty + * @return true if the given stack if empty * * @since 1.6 */ @@ -2613,19 +2627,19 @@ public class Digester extends DefaultHan } return result; } - + /** - * When the Digester is being used as a SAXContentHandler, + * When the Digester is being used as a SAXContentHandler, * this method allows you to access the root object that has been * created after parsing. - * + * * @return the root object that has been created after parsing * or null if the digester has not parsed any XML yet. */ public Object getRoot() { return root; } - + // ------------------------------------------------ Parameter Stack Methods @@ -2643,7 +2657,7 @@ public class Digester extends DefaultHan * <p> * <strong>Note</strong> This method may be called more than once. * Once only initialization code should be placed in {@link #initialize} - * or the code should take responsibility by checking and setting the + * or the code should take responsibility by checking and setting the * {@link #configured} flag. * </p> */ @@ -2665,19 +2679,19 @@ public class Digester extends DefaultHan configured = true; } - + /** * <p> * Provides a hook for lazy initialization of this <code>Digester</code> - * instance. + * instance. * The default implementation does nothing, but subclasses * can override as needed. * Digester (by default) only calls this method once. * </p> * * <p> - * <strong>Note</strong> This method will be called by {@link #configure} - * only when the {@link #configured} flag is false. + * <strong>Note</strong> This method will be called by {@link #configure} + * only when the {@link #configured} flag is false. * Subclasses that override <code>configure</code> or who set <code>configured</code> * may find that this method may be called more than once. * </p> @@ -2689,7 +2703,7 @@ public class Digester extends DefaultHan // Perform lazy initialization as needed // Nothing required by default - } + } // -------------------------------------------------------- Package Methods @@ -2728,7 +2742,7 @@ public class Digester extends DefaultHan * <p>Return the top object on the parameters stack without removing it. If there are * no objects on the stack, return <code>null</code>.</p> * - * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. + * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> */ public Object peekParams() { @@ -2748,7 +2762,7 @@ public class Digester extends DefaultHan * and [getCount()-1] is the bottom element. If the specified index * is out of range, return <code>null</code>.</p> * - * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. + * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> * * @param n Index of the desired element, where 0 is the top of the stack, @@ -2770,7 +2784,7 @@ public class Digester extends DefaultHan * <p>Pop the top object off of the parameters stack, and return it. If there are * no objects on the stack, return <code>null</code>.</p> * - * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. + * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> */ public Object popParams() { @@ -2791,7 +2805,7 @@ public class Digester extends DefaultHan /** * <p>Push a new object onto the top of the parameters stack.</p> * - * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. + * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> * * @param object The new object @@ -2820,7 +2834,7 @@ public class Digester extends DefaultHan } if (locator != null) { String error = "Error at (" + locator.getLineNumber() + ", " + - locator.getColumnNumber() + ": " + message; + locator.getColumnNumber() + ") : " + message; if (e != null) { return new SAXParseException(error, locator, e); } else { @@ -2860,7 +2874,7 @@ public class Digester extends DefaultHan public SAXException createSAXException(String message) { return createSAXException(message, null); } - + // ------------------------------------------------------- Private Methods @@ -2875,13 +2889,13 @@ public class Digester extends DefaultHan if (list.getLength() == 0) { return list; } - + AttributesImpl newAttrs = new AttributesImpl(list); int nAttributes = newAttrs.getLength(); for (int i = 0; i < nAttributes; ++i) { String value = newAttrs.getValue(i); try { - String newValue = + String newValue = IntrospectionUtils.replaceProperties(value, null, source); if (value != newValue) { newAttrs.setValue(i, newValue); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org