Author: fhanik
Date: Tue Oct  2 15:45:26 2007
New Revision: 581422

URL: http://svn.apache.org/viewvc?rev=581422&view=rev
Log:
Improved version of the attribute checker implementation.
Any resource can implement 'boolean setProperty' and control the value being 
returned
no need for setPropertyInternal or a specific check inside the connector anymore
Http11Protocol needs to be reworked to fit into this model, should be pretty 
easy
Resources all have generic setProperty methods with no way of knowing what 
properties are used and not used, not sure about this one


Modified:
    tomcat/sandbox/gdev6x/java/org/apache/catalina/connector/Connector.java
    tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
    tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/util/IDynamicProperty.java
    tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Catalina.java
    tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Embedded.java
    
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetAllPropertiesRule.java
    
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetContextPropertiesRule.java
    tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpAprProtocol.java
    tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpProtocol.java
    tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11Protocol.java
    tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/IntrospectionUtils.java
    tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/Digester.java
    
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
    
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertyRule.java
    tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/catalina/connector/Connector.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/connector/Connector.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/catalina/connector/Connector.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/catalina/connector/Connector.java Tue 
Oct  2 15:45:26 2007
@@ -313,12 +313,12 @@
     /**
      * Set a configured property.
      */
-    public void setProperty(String name, String value) {
+    public boolean setProperty(String name, String value) {
         String repl = name;
         if (replacements.get(name) != null) {
             repl = (String) replacements.get(name);
         }
-        IntrospectionUtils.setProperty(protocolHandler, repl, value);
+        return IntrospectionUtils.setProperty(protocolHandler, repl, value);
     }
 
 

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java 
Tue Oct  2 15:45:26 2007
@@ -407,8 +407,8 @@
      * @param name
      * @param value
      */
-    public void setProperty(String name, String value) {
-        setProperty(name, (Object) value);
+    public boolean setProperty(String name, String value) {
+        return setProperty(name, (Object) value);
     }
 
     /**
@@ -417,7 +417,7 @@
      * @param name
      * @param value
      */
-    public void setProperty(String name, Object value) {
+    public boolean setProperty(String name, Object value) {
         if (log.isTraceEnabled())
             log.trace(sm.getString("SimpleTcpCluster.setProperty", name, 
value,properties.get(name)));
         properties.put(name, value);
@@ -425,21 +425,7 @@
         //if exposed through JMX. This way you can sit and try to guess 
property names,
         //we will only allow explicit property names
         log.warn("Dynamic setProperty("+name+",value) has been disabled, 
please use explicit properties for the element you are trying to identify");
-        if(started) {
-            // FIXME Hmm, is that correct when some DeltaManagers are direct 
configured inside Context?
-            // Why we not support it for other elements, like sender, receiver 
or membership?
-            // Must we restart element after change?
-//            if (name.startsWith("manager")) {
-//                String key = name.substring("manager".length() + 1);
-//                String pvalue = value.toString();
-//                for (Iterator iter = managers.values().iterator(); 
iter.hasNext();) {
-//                    Manager manager = (Manager) iter.next();
-//                    if(manager instanceof DeltaManager && ((ClusterManager) 
manager).isDefaultMode()) {
-//                        IntrospectionUtils.setProperty(manager, key, pvalue 
);
-//                    }
-//                }
-//            } 
-        }
+        return false;
     }
 
     /**

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/util/IDynamicProperty.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/util/IDynamicProperty.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- 
tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/util/IDynamicProperty.java 
(original)
+++ 
tomcat/sandbox/gdev6x/java/org/apache/catalina/ha/util/IDynamicProperty.java 
Tue Oct  2 15:45:26 2007
@@ -32,7 +32,7 @@
      * @param name
      * @param value
      */
-    public void setProperty(String name, Object value) ;
+    public boolean setProperty(String name, Object value) ;
 
     /**
      * get current config

Modified: tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Catalina.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Catalina.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Catalina.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Catalina.java Tue 
Oct  2 15:45:26 2007
@@ -21,10 +21,14 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 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

Modified: tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Embedded.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Embedded.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Embedded.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/Embedded.java Tue 
Oct  2 15:45:26 2007
@@ -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: 
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetAllPropertiesRule.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetAllPropertiesRule.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- 
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetAllPropertiesRule.java
 (original)
+++ 
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetAllPropertiesRule.java
 Tue Oct  2 15:45:26 2007
@@ -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: 
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetContextPropertiesRule.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetContextPropertiesRule.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- 
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetContextPropertiesRule.java
 (original)
+++ 
tomcat/sandbox/gdev6x/java/org/apache/catalina/startup/SetContextPropertiesRule.java
 Tue Oct  2 15:45:26 2007
@@ -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: tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpAprProtocol.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpAprProtocol.java Tue 
Oct  2 15:45:26 2007
@@ -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: tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpProtocol.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/sandbox/gdev6x/java/org/apache/coyote/ajp/AjpProtocol.java Tue Oct  
2 15:45:26 2007
@@ -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: 
tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11AprProtocol.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11AprProtocol.java 
Tue Oct  2 15:45:26 2007
@@ -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,14 +311,9 @@
     public void setRestrictedUserAgents(String valueS) { restrictedUserAgents 
= valueS; }
     
     
-    public String getProtocol() {
-        return getProperty("protocol");
-    }
-
-    public void setProtocol( String k ) {
-        setSecure(true);
-        setAttribute("protocol", k);
-    }
+    protected String protocol = null;
+    public String getProtocol() { return protocol; }
+    public void setProtocol(String protocol) { setSecure(true); this.protocol 
= protocol; }
 
     /**
      * Maximum number of requests which can be performed over a keepalive 

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11NioProtocol.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11NioProtocol.java 
Tue Oct  2 15:45:26 2007
@@ -94,13 +94,14 @@
     /**
      * Set a property.
      */
-    public void setProperty(String name, String value) {
+    public boolean setProperty(String name, String value) {
+        setAttribute(name, value); //store all settings
         if ( name!=null && (name.startsWith("socket.") 
||name.startsWith("selectorPool.")) ){
-            ep.setProperty(name, value);
+            return ep.setProperty(name, value);
         } else {
-            ep.setProperty(name,value); //make sure we at least try to set all 
properties
+            return ep.setProperty(name,value); //make sure we at least try to 
set all properties
         }
-        setAttribute(name, value);
+        
     }
 
     /**

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11Protocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11Protocol.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11Protocol.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/Http11Protocol.java Tue 
Oct  2 15:45:26 2007
@@ -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) {
@@ -134,6 +120,19 @@
         return attributes.keySet().iterator();
     }
 
+    /**
+     * 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.

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/IntrospectionUtils.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/IntrospectionUtils.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/IntrospectionUtils.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/IntrospectionUtils.java 
Tue Oct  2 15:45:26 2007
@@ -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 + ")");
 
@@ -266,7 +266,8 @@
 
         try {
             Method methods[] = findMethods(o.getClass());
-            Method setPropertyMethod = null;
+            Method setPropertyMethodVoid = null;
+            Method setPropertyMethodBool = null;
 
             // First, the ideal case - a setFoo( String ) method
             for (int i = 0; i < methods.length; i++) {
@@ -275,7 +276,7 @@
                         && "java.lang.String".equals(paramT[0].getName())) {
 
                     methods[i].invoke(o, new Object[] { value });
-                    return;
+                    return true;
                 }
             }
 
@@ -328,22 +329,32 @@
 
                     if (ok) {
                         methods[i].invoke(o, params);
-                        return;
+                        return true;
                     }
                 }
 
                 // save "setProperty" for later
                 if ("setProperty".equals(methods[i].getName())) {
-                    setPropertyMethod = methods[i];
+                    if (methods[i].getReturnType()==Boolean.TYPE){
+                        setPropertyMethodBool = methods[i];
+                    }else {
+                        setPropertyMethodVoid = methods[i];    
+                    }
+                    
                 }
             }
 
             // Ok, no setXXX found, try a setProperty("name", "value")
-            if (setPropertyMethod != null) {
+            if (setPropertyMethodBool != null || setPropertyMethodVoid != 
null) {
                 Object params[] = new Object[2];
                 params[0] = name;
                 params[1] = value;
-                setPropertyMethod.invoke(o, params);
+                if (setPropertyMethodBool != null) {
+                    return (Boolean) setPropertyMethodBool.invoke(o, params);
+                } else {
+                    setPropertyMethodVoid.invoke(o, params);
+                    return true;
+                }
             }
 
         } catch (IllegalArgumentException ex2) {
@@ -367,6 +378,7 @@
             if (dbg > 1)
                 ie.printStackTrace();
         }
+        return false;
     }
 
     public static Object getProperty(Object o, String name) {

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/Digester.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/Digester.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/Digester.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/Digester.java 
Tue Oct  2 15:45:26 2007
@@ -312,6 +312,19 @@
     protected boolean validating = false;
 
 
+    
+    /**
+     * 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.
      */
@@ -889,6 +902,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 
@@ -1037,6 +1116,9 @@
         } else {
             if (debug) {
                 log.debug("  No rules found matching '" + match + "'.");
+            }
+            if (rulesValidation) {
+                log.warn("  No rules found matching '" + match + "'.");
             }
         }
 

Modified: 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertiesRule.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
 (original)
+++ 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
 Tue Oct  2 15:45:26 2007
@@ -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: 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertyRule.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertyRule.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertyRule.java 
(original)
+++ 
tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/digester/SetPropertyRule.java 
Tue Oct  2 15:45:26 2007
@@ -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.");
+        }
 
     }
 

Modified: tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=581422&r1=581421&r2=581422&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/sandbox/gdev6x/java/org/apache/tomcat/util/net/NioEndpoint.java Tue 
Oct  2 15:45:26 2007
@@ -501,19 +501,20 @@
     /**
      * Generic properties, introspected
      */
-    public void setProperty(String name, String value) {
+    public boolean setProperty(String name, String value) {
         final String selectorPoolName = "selectorPool.";
         final String socketName = "socket.";
         try {
             if (name.startsWith(selectorPoolName)) {
-                IntrospectionUtils.setProperty(selectorPool, 
name.substring(selectorPoolName.length()), value);
+                return IntrospectionUtils.setProperty(selectorPool, 
name.substring(selectorPoolName.length()), value);
             } else if (name.startsWith(socketName)) {
-                IntrospectionUtils.setProperty(socketProperties, 
name.substring(socketName.length()), value);
+                return IntrospectionUtils.setProperty(socketProperties, 
name.substring(socketName.length()), value);
             } else {
-                IntrospectionUtils.setProperty(this,name,value);
+                return IntrospectionUtils.setProperty(this,name,value);
             }
         }catch ( Exception x ) {
             log.error("Unable to set attribute \""+name+"\" to 
\""+value+"\"",x);
+            return false;
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to