[jbossweb-commits] JBossWeb SVN: r219 - in trunk/java/org/apache: catalina/startup and 4 other directories.
jbossweb-commits at lists.jboss.org
jbossweb-commits at lists.jboss.org
Thu Aug 9 12:48:46 EDT 2007
Author: remy.maucherat at jboss.com
Date: 2007-08-09 12:48:46 -0400 (Thu, 09 Aug 2007)
New Revision: 219
Removed:
trunk/java/org/apache/catalina/startup/ClusterRuleSetFactory.java
Modified:
trunk/java/org/apache/catalina/connector/Connector.java
trunk/java/org/apache/catalina/startup/Catalina.java
trunk/java/org/apache/catalina/startup/Embedded.java
trunk/java/org/apache/catalina/startup/SetAllPropertiesRule.java
trunk/java/org/apache/catalina/startup/SetContextPropertiesRule.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
trunk/java/org/apache/tomcat/util/digester/Digester.java
trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java
Log:
- Remove cluster ruleset for now.
- Add simple validation for server.xml (will log WARN if elements or attributes which are not defined in the rules or
on the objects are used in the XML).
Modified: trunk/java/org/apache/catalina/connector/Connector.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Connector.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/catalina/connector/Connector.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -318,6 +318,20 @@
if (replacements.get(name) != null) {
repl = (String) replacements.get(name);
}
+ if (!IntrospectionUtils.setProperty(protocolHandler, repl, value)) {
+ log.warn("Property " + name + " not found on the protocol handler.");
+ }
+ }
+
+
+ /**
+ * Set a configured property.
+ */
+ public void setPropertyInternal(String name, String value) {
+ String repl = name;
+ if (replacements.get(name) != null) {
+ repl = (String) replacements.get(name);
+ }
IntrospectionUtils.setProperty(protocolHandler, repl, value);
}
@@ -388,7 +402,7 @@
public void setAllowTrace(boolean allowTrace) {
this.allowTrace = allowTrace;
- setProperty("allowTrace", String.valueOf(allowTrace));
+ setPropertyInternal("allowTrace", String.valueOf(allowTrace));
}
@@ -466,7 +480,7 @@
public void setEmptySessionPath(boolean emptySessionPath) {
this.emptySessionPath = emptySessionPath;
- setProperty("emptySessionPath", String.valueOf(emptySessionPath));
+ setPropertyInternal("emptySessionPath", String.valueOf(emptySessionPath));
}
@@ -489,7 +503,7 @@
public void setEnableLookups(boolean enableLookups) {
this.enableLookups = enableLookups;
- setProperty("enableLookups", String.valueOf(enableLookups));
+ setPropertyInternal("enableLookups", String.valueOf(enableLookups));
}
@@ -559,7 +573,7 @@
public void setMaxSavePostSize(int maxSavePostSize) {
this.maxSavePostSize = maxSavePostSize;
- setProperty("maxSavePostSize", String.valueOf(maxSavePostSize));
+ setPropertyInternal("maxSavePostSize", String.valueOf(maxSavePostSize));
}
@@ -581,7 +595,7 @@
public void setPort(int port) {
this.port = port;
- setProperty("port", String.valueOf(port));
+ setPropertyInternal("port", String.valueOf(port));
}
@@ -745,7 +759,7 @@
if(proxyName != null && proxyName.length() > 0) {
this.proxyName = proxyName;
- setProperty("proxyName", proxyName);
+ setPropertyInternal("proxyName", proxyName);
} else {
this.proxyName = null;
removeProperty("proxyName");
@@ -772,7 +786,7 @@
public void setProxyPort(int proxyPort) {
this.proxyPort = proxyPort;
- setProperty("proxyPort", String.valueOf(proxyPort));
+ setPropertyInternal("proxyPort", String.valueOf(proxyPort));
}
@@ -797,7 +811,7 @@
public void setRedirectPort(int redirectPort) {
this.redirectPort = redirectPort;
- setProperty("redirectPort", String.valueOf(redirectPort));
+ setPropertyInternal("redirectPort", String.valueOf(redirectPort));
}
@@ -846,7 +860,7 @@
public void setSecure(boolean secure) {
this.secure = secure;
- setProperty("secure", Boolean.toString(secure));
+ setPropertyInternal("secure", Boolean.toString(secure));
}
/**
@@ -867,7 +881,7 @@
public void setURIEncoding(String URIEncoding) {
this.URIEncoding = URIEncoding;
- setProperty("uRIEncoding", URIEncoding);
+ setPropertyInternal("uRIEncoding", URIEncoding);
}
@@ -890,7 +904,7 @@
public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
this.useBodyEncodingForURI = useBodyEncodingForURI;
- setProperty
+ setPropertyInternal
("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
}
@@ -918,7 +932,7 @@
*/
public void setXpoweredBy(boolean xpoweredBy) {
this.xpoweredBy = xpoweredBy;
- setProperty("xpoweredBy", String.valueOf(xpoweredBy));
+ setPropertyInternal("xpoweredBy", String.valueOf(xpoweredBy));
}
/**
@@ -929,7 +943,7 @@
*/
public void setUseIPVHosts(boolean useIPVHosts) {
this.useIPVHosts = useIPVHosts;
- setProperty("useIPVHosts", String.valueOf(useIPVHosts));
+ setPropertyInternal("useIPVHosts", String.valueOf(useIPVHosts));
}
/**
Modified: trunk/java/org/apache/catalina/startup/Catalina.java
===================================================================
--- trunk/java/org/apache/catalina/startup/Catalina.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/catalina/startup/Catalina.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -25,6 +25,10 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
import org.apache.catalina.Container;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
@@ -260,6 +264,12 @@
// Initialize the digester
Digester digester = new Digester();
digester.setValidating(false);
+ digester.setRulesValidation(true);
+ HashMap<Class, List<String>> fakeAttributes = new HashMap<Class, List<String>>();
+ ArrayList<String> attrs = new ArrayList<String>();
+ attrs.add("className");
+ fakeAttributes.put(Object.class, attrs);
+ digester.setFakeAttributes(fakeAttributes);
digester.setClassLoader(StandardServer.class.getClassLoader());
// Configure the actions we will be using
@@ -321,9 +331,7 @@
"addConnector",
"org.apache.catalina.connector.Connector");
-
-
digester.addObjectCreate("Server/Service/Connector/Listener",
null, // MUST be specified in the element
"className");
@@ -337,13 +345,11 @@
digester.addRuleSet(new EngineRuleSet("Server/Service/"));
digester.addRuleSet(new HostRuleSet("Server/Service/Engine/"));
digester.addRuleSet(new ContextRuleSet("Server/Service/Engine/Host/"));
- digester.addRuleSet(ClusterRuleSetFactory.getClusterRuleSet("Server/Service/Engine/Host/Cluster/"));
digester.addRuleSet(new NamingRuleSet("Server/Service/Engine/Host/Context/"));
// When the 'engine' is found, set the parentClassLoader.
digester.addRule("Server/Service/Engine",
new SetParentClassLoaderRule(parentClassLoader));
- digester.addRuleSet(ClusterRuleSetFactory.getClusterRuleSet("Server/Service/Engine/Cluster/"));
long t2=System.currentTimeMillis();
if (log.isDebugEnabled())
Deleted: trunk/java/org/apache/catalina/startup/ClusterRuleSetFactory.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ClusterRuleSetFactory.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/catalina/startup/ClusterRuleSetFactory.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * 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.catalina.startup;
-
-
-import org.apache.tomcat.util.digester.Digester;
-import org.apache.tomcat.util.digester.RuleSetBase;
-import java.lang.reflect.Constructor;
-
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-
-import java.lang.reflect.InvocationTargetException;
-public class ClusterRuleSetFactory {
-
- public static Log log = LogFactory.getLog(ClusterRuleSetFactory.class);
-
- public static RuleSetBase getClusterRuleSet(String prefix) {
-
- //OLD CLUSTER 1
- //first try the same classloader as this class server/lib
- try {
- return loadRuleSet(prefix,"org.apache.catalina.cluster.ClusterRuleSet",ClusterRuleSetFactory.class.getClassLoader());
- } catch ( Exception x ) {
- //display warning
- if ( log.isDebugEnabled() ) log.debug("Unable to load ClusterRuleSet (org.apache.catalina.cluster.ClusterRuleSet), falling back on context classloader");
- }
- //try to load it from the context class loader
- try {
- return loadRuleSet(prefix,"org.apache.catalina.cluster.ClusterRuleSet",Thread.currentThread().getContextClassLoader());
- } catch ( Exception x ) {
- //display warning
- if ( log.isDebugEnabled() ) log.debug("Unable to load ClusterRuleSet (org.apache.catalina.cluster.ClusterRuleSet), will try to load the HA cluster");
- }
-
- //NEW CLUSTER 2
- //first try the same classloader as this class server/lib
- try {
- return loadRuleSet(prefix,"org.apache.catalina.ha.ClusterRuleSet",ClusterRuleSetFactory.class.getClassLoader());
- } catch ( Exception x ) {
- //display warning
- if ( log.isDebugEnabled() ) log.debug("Unable to load HA ClusterRuleSet (org.apache.catalina.ha.ClusterRuleSet), falling back on context classloader");
- }
- //try to load it from the context class loader
- try {
- return loadRuleSet(prefix,"org.apache.catalina.ha.ClusterRuleSet",Thread.currentThread().getContextClassLoader());
- } catch ( Exception x ) {
- //display warning
- if ( log.isDebugEnabled() ) log.debug("Unable to load HA ClusterRuleSet (org.apache.catalina.ha.ClusterRuleSet), falling back on DefaultClusterRuleSet");
- }
-
- log.info("Unable to find a cluster rule set in the classpath. Will load the default rule set.");
- return new DefaultClusterRuleSet(prefix);
- }
-
-
- protected static RuleSetBase loadRuleSet(String prefix, String className, ClassLoader cl)
- throws ClassNotFoundException, InstantiationException,
- NoSuchMethodException,IllegalAccessException,
- InvocationTargetException {
- Class clazz = Class.forName(className,true,cl);
- Constructor cons = clazz.getConstructor(new Class[] {String.class});
- return (RuleSetBase)cons.newInstance(prefix);
- }
-
- /**
- * <p><strong>RuleSet</strong> for processing the contents of a
- * Cluster definition element. </p>
- *
- * @author Filip Hanik
- * @author Peter Rossbach
- * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
- */
-
- public static class DefaultClusterRuleSet extends RuleSetBase {
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * The matching pattern prefix to use for recognizing our elements.
- */
- protected String prefix = null;
-
-
- // ------------------------------------------------------------ Constructor
-
-
- /**
- * Construct an instance of this <code>RuleSet</code> with the default
- * matching pattern prefix.
- */
- public DefaultClusterRuleSet() {
-
- this("");
-
- }
-
-
- /**
- * Construct an instance of this <code>RuleSet</code> with the specified
- * matching pattern prefix.
- *
- * @param prefix Prefix for matching pattern rules (including the
- * trailing slash character)
- */
- public DefaultClusterRuleSet(String prefix) {
- super();
- this.namespaceURI = null;
- this.prefix = prefix;
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * <p>Add the set of Rule instances defined in this RuleSet to the
- * specified <code>Digester</code> instance, associating them with
- * our namespace URI (if any). This method should only be called
- * by a Digester instance.</p>
- *
- * @param digester Digester instance to which the new Rule instances
- * should be added.
- */
- public void addRuleInstances(Digester digester) {
- //Cluster configuration start
- digester.addObjectCreate(prefix + "Membership",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "Membership");
- digester.addSetNext(prefix + "Membership",
- "setMembershipService",
- "org.apache.catalina.cluster.MembershipService");
-
- digester.addObjectCreate(prefix + "Sender",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "Sender");
- digester.addSetNext(prefix + "Sender",
- "setClusterSender",
- "org.apache.catalina.cluster.ClusterSender");
-
- digester.addObjectCreate(prefix + "Receiver",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "Receiver");
- digester.addSetNext(prefix + "Receiver",
- "setClusterReceiver",
- "org.apache.catalina.cluster.ClusterReceiver");
-
- digester.addObjectCreate(prefix + "Valve",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "Valve");
- digester.addSetNext(prefix + "Valve",
- "addValve",
- "org.apache.catalina.Valve");
-
- digester.addObjectCreate(prefix + "Deployer",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "Deployer");
- digester.addSetNext(prefix + "Deployer",
- "setClusterDeployer",
- "org.apache.catalina.cluster.ClusterDeployer");
-
- digester.addObjectCreate(prefix + "Listener",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "Listener");
- digester.addSetNext(prefix + "Listener",
- "addLifecycleListener",
- "org.apache.catalina.LifecycleListener");
-
- digester.addObjectCreate(prefix + "ClusterListener",
- null, // MUST be specified in the element
- "className");
- digester.addSetProperties(prefix + "ClusterListener");
- digester.addSetNext(prefix + "ClusterListener",
- "addClusterListener",
- "org.apache.catalina.cluster.MessageListener");
- //Cluster configuration end
- }
-
-
- }
-}
Modified: trunk/java/org/apache/catalina/startup/Embedded.java
===================================================================
--- trunk/java/org/apache/catalina/startup/Embedded.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/catalina/startup/Embedded.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -427,7 +427,7 @@
connector = new Connector();
connector.setScheme("https");
connector.setSecure(true);
- connector.setProperty("SSLEnabled","true");
+ connector.setPropertyInternal("SSLEnabled","true");
// FIXME !!!! SET SSL PROPERTIES
} else {
connector = new Connector(protocol);
Modified: trunk/java/org/apache/catalina/startup/SetAllPropertiesRule.java
===================================================================
--- trunk/java/org/apache/catalina/startup/SetAllPropertiesRule.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/catalina/startup/SetAllPropertiesRule.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -62,8 +62,15 @@
name = attributes.getQName(i);
}
String value = attributes.getValue(i);
- if ( !excludes.containsKey(name))
- IntrospectionUtils.setProperty(digester.peek(), name, value);
+ if ( !excludes.containsKey(name)) {
+ if (!digester.isFakeAttribute(digester.peek(), name)
+ && !IntrospectionUtils.setProperty(digester.peek(), name, value)
+ && digester.getRulesValidation()) {
+ digester.getLogger().warn("[SetAllPropertiesRule]{" + digester.getMatch() +
+ "} Setting property '" + name + "' to '" +
+ value + "' did not find a matching property.");
+ }
+ }
}
}
Modified: trunk/java/org/apache/catalina/startup/SetContextPropertiesRule.java
===================================================================
--- trunk/java/org/apache/catalina/startup/SetContextPropertiesRule.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/catalina/startup/SetContextPropertiesRule.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -60,7 +60,13 @@
continue;
}
String value = attributes.getValue(i);
- IntrospectionUtils.setProperty(digester.peek(), name, value);
+ if (!digester.isFakeAttribute(digester.peek(), name)
+ && !IntrospectionUtils.setProperty(digester.peek(), name, value)
+ && digester.getRulesValidation()) {
+ digester.getLogger().warn("[SetContextPropertiesRule]{" + digester.getMatch() +
+ "} Setting property '" + name + "' to '" +
+ value + "' did not find a matching property.");
+ }
}
}
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -137,22 +137,6 @@
/**
- * Set a property.
- */
- public void setProperty(String name, String value) {
- setAttribute(name, value);
- }
-
-
- /**
- * Get a property
- */
- public String getProperty(String name) {
- return (String) getAttribute(name);
- }
-
-
- /**
* The adapter, used to call the connector
*/
public void setAdapter(Adapter adapter) {
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -90,20 +90,6 @@
}
/**
- * Set a property.
- */
- public void setProperty(String name, String value) {
- setAttribute(name, value);
- }
-
- /**
- * Get a property
- */
- public String getProperty(String name) {
- return (String)getAttribute(name);
- }
-
- /**
* The adapter, used to call the connector.
*/
protected Adapter adapter;
@@ -325,15 +311,11 @@
public void setRestrictedUserAgents(String valueS) { restrictedUserAgents = valueS; }
- public String getProtocol() {
- return getProperty("protocol");
- }
+ // HTTP
+ protected String protocol = null;
+ public String getProtocol() { return protocol; }
+ public void setProtocol(String protocol) { setSecure(true); this.protocol = protocol; }
- public void setProtocol( String k ) {
- setSecure(true);
- setAttribute("protocol", k);
- }
-
/**
* Maximum number of requests which can be performed over a keepalive
* connection. The default is the same as for Apache HTTP Server.
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -103,20 +103,6 @@
/**
- * Set a property.
- */
- public void setProperty(String name, String value) {
- setAttribute(name, value);
- }
-
- /**
- * Get a property
- */
- public String getProperty(String name) {
- return (String)getAttribute(name);
- }
-
- /**
* Pass config info
*/
public void setAttribute(String name, Object value) {
Modified: trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -258,7 +258,7 @@
* int or boolean we'll convert value to the right type before) - that means
* you can have setDebug(1).
*/
- public static void setProperty(Object o, String name, String value) {
+ public static boolean setProperty(Object o, String name, String value) {
if (dbg > 1)
d("setProperty(" + o.getClass() + " " + name + "=" + value + ")");
@@ -275,7 +275,7 @@
&& "java.lang.String".equals(paramT[0].getName())) {
methods[i].invoke(o, new Object[] { value });
- return;
+ return true;
}
}
@@ -328,7 +328,7 @@
if (ok) {
methods[i].invoke(o, params);
- return;
+ return true;
}
}
@@ -344,6 +344,7 @@
params[0] = name;
params[1] = value;
setPropertyMethod.invoke(o, params);
+ return true;
}
} catch (IllegalArgumentException ex2) {
@@ -367,6 +368,7 @@
if (dbg > 1)
ie.printStackTrace();
}
+ return false;
}
public static Object getProperty(Object o, String name) {
Modified: trunk/java/org/apache/tomcat/util/digester/Digester.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/Digester.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/tomcat/util/digester/Digester.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -313,6 +313,18 @@
/**
+ * Warn on missing attributes and elements.
+ */
+ protected boolean rulesValidation = false;
+
+
+ /**
+ * Fake attributes map (attributes are often used for object creation).
+ */
+ protected Map<Class, List<String>> fakeAttributes = null;
+
+
+ /**
* The Log to which most logging calls will be made.
*/
protected Log log =
@@ -889,6 +901,72 @@
/**
+ * Return the rules validation flag.
+ */
+ public boolean getRulesValidation() {
+
+ return (this.rulesValidation);
+
+ }
+
+
+ /**
+ * Set the rules validation flag. This must be called before
+ * <code>parse()</code> is called the first time.
+ *
+ * @param rulesValidation The new rules validation flag.
+ */
+ public void setRulesValidation(boolean rulesValidation) {
+
+ this.rulesValidation = rulesValidation;
+
+ }
+
+
+ /**
+ * Return the fake attributes list.
+ */
+ public Map<Class, List<String>> getFakeAttributes() {
+
+ return (this.fakeAttributes);
+
+ }
+
+
+ /**
+ * Determine if an attribute is a fake attribute.
+ */
+ public boolean isFakeAttribute(Object object, String name) {
+
+ if (fakeAttributes == null) {
+ return false;
+ }
+ List<String> result = fakeAttributes.get(object.getClass());
+ if (result == null) {
+ result = fakeAttributes.get(Object.class);
+ }
+ if (result == null) {
+ return false;
+ } else {
+ return result.contains(name);
+ }
+
+ }
+
+
+ /**
+ * Set the fake attributes.
+ *
+ * @param fakeAttributes The new fake attributes.
+ */
+ public void setFakeAttributes(Map<Class, List<String>> fakeAttributes) {
+
+ this.fakeAttributes = fakeAttributes;
+
+ }
+
+
+ /**
* 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
@@ -1286,6 +1364,9 @@
if (debug) {
log.debug(" No rules found matching '" + match + "'.");
}
+ if (rulesValidation) {
+ log.warn(" No rules found matching '" + match + "'.");
+ }
}
}
Modified: trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/tomcat/util/digester/SetPropertiesRule.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -205,7 +205,13 @@
"} Setting property '" + name + "' to '" +
value + "'");
}
- IntrospectionUtils.setProperty(top, name, value);
+ if (!digester.isFakeAttribute(top, name)
+ && !IntrospectionUtils.setProperty(top, name, value)
+ && digester.getRulesValidation()) {
+ digester.log.warn("[SetPropertiesRule]{" + digester.match +
+ "} Setting property '" + name + "' to '" +
+ value + "' did not find a matching property.");
+ }
}
}
Modified: trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java
===================================================================
--- trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java 2007-08-09 16:47:04 UTC (rev 218)
+++ trunk/java/org/apache/tomcat/util/digester/SetPropertyRule.java 2007-08-09 16:48:46 UTC (rev 219)
@@ -125,8 +125,13 @@
}
// Set the property (with conversion as necessary)
- // FIXME: Exception if property doesn't exist ?
- IntrospectionUtils.setProperty(top, actualName, actualValue);
+ if (!digester.isFakeAttribute(top, actualName)
+ && !IntrospectionUtils.setProperty(top, actualName, actualValue)
+ && digester.getRulesValidation()) {
+ digester.log.warn("[SetPropertyRule]{" + digester.match +
+ "} Setting property '" + name + "' to '" +
+ value + "' did not find a matching property.");
+ }
}
More information about the jbossweb-commits
mailing list