You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2006/01/21 01:21:00 UTC

svn commit: r370938 [5/50] - in /struts: action/trunk/ action/trunk/conf/java/ action/trunk/src/java/org/apache/struts/ action/trunk/src/java/org/apache/struts/action/ action/trunk/src/java/org/apache/struts/chain/ action/trunk/src/java/org/apache/stru...

Modified: struts/action/trunk/src/java/org/apache/struts/action/ActionServletWrapper.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/ActionServletWrapper.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/ActionServletWrapper.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/ActionServletWrapper.java Fri Jan 20 16:19:02 2006
@@ -15,56 +15,49 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.struts.action;
 
-import java.io.Serializable;
 import org.apache.struts.upload.MultipartRequestHandler;
 
+import java.io.Serializable;
 
 /**
- * <p>Provide a wrapper around an {@link ActionServlet} to expose only
- * those methods needed by other objects. When used with an
- * {@link ActionForm}, subclasses must be careful that they do
- * not return an object with public getters and setters that
- * could be exploited by automatic population of properties.</p>
+ * <p>Provide a wrapper around an {@link ActionServlet} to expose only those
+ * methods needed by other objects. When used with an {@link ActionForm},
+ * subclasses must be careful that they do not return an object with public
+ * getters and setters that could be exploited by automatic population of
+ * properties.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  * @since Struts 1.0.1
  */
 public class ActionServletWrapper implements Serializable {
-
     /**
      * <p>The servlet instance to which we are attached.</p>
      */
     protected transient ActionServlet servlet = null;
 
     /**
-     * <p>Set servlet to a <code>MultipartRequestHandler</code>.</p>
+     * <p>Create object and set <code>servlet</code> property.</p>
      *
-     * @param object The MultipartRequestHandler
+     * @param servlet <code>ActionServlet</code> to wrap
      */
-     public void setServletFor(MultipartRequestHandler object) {
-
-        object.setServlet(this.servlet);
-        // :FIXME: Should this be based on an "setServlet"
-        // interface or introspection for a setServlet method?
-        // Or, is it safer to just add the types we want as we want them?
-
+    public ActionServletWrapper(ActionServlet servlet) {
+        super();
+        this.servlet = servlet;
     }
 
-
     /**
-     * <p>Create object and set <code>servlet</code> property.</p>
+     * <p>Set servlet to a <code>MultipartRequestHandler</code>.</p>
      *
-     * @param servlet <code>ActionServlet</code> to wrap
+     * @param object The MultipartRequestHandler
      */
-     public ActionServletWrapper(ActionServlet servlet) {
-
-        super();
-        this.servlet = servlet;
+    public void setServletFor(MultipartRequestHandler object) {
+        object.setServlet(this.servlet);
 
+        // :FIXME: Should this be based on an "setServlet"
+        // interface or introspection for a setServlet method?
+        // Or, is it safer to just add the types we want as we want them?
     }
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/action/DynaActionForm.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/DynaActionForm.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/DynaActionForm.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/DynaActionForm.java Fri Jan 20 16:19:02 2006
@@ -15,19 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.action;
 
-import java.lang.reflect.Array;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.commons.beanutils.ConversionException;
 import org.apache.commons.beanutils.DynaBean;
 import org.apache.commons.beanutils.DynaClass;
@@ -35,45 +24,48 @@
 import org.apache.struts.config.FormBeanConfig;
 import org.apache.struts.config.FormPropertyConfig;
 
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Array;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
 
 /**
  * <p>Specialized subclass of <code>ActionForm</code> that allows the creation
  * of form beans with dynamic sets of properties, without requiring the
  * developer to create a Java class for each type of form bean.</p>
  *
- * <p><strong>USAGE NOTE</strong> - Since Struts 1.1, the
- * <code>reset</code> method no longer initializes property values to those
- * specified in <code>&lt;form-property&gt;</code> elements in the Struts
- * module configuration file.  If you wish to utilize that behavior, the
- * simplest solution is to subclass <code>DynaActionForm</code> and call
- * the <code>initialize</code> method inside it.</p>
+ * <p><strong>USAGE NOTE</strong> - Since Struts 1.1, the <code>reset</code>
+ * method no longer initializes property values to those specified in
+ * <code>&lt;form-property&gt;</code> elements in the Struts module
+ * configuration file.  If you wish to utilize that behavior, the simplest
+ * solution is to subclass <code>DynaActionForm</code> and call the
+ * <code>initialize</code> method inside it.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-11-12 11:52:08 -0500 (Sat, 12 Nov 2005)
+ *          $
  * @since Struts 1.1
  */
 public class DynaActionForm extends ActionForm implements DynaBean {
-
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * <p>The <code>DynaActionFormClass</code> with which we are associated.
      * </p>
      */
     protected DynaActionFormClass dynaClass = null;
 
-
     /**
      * <p>The set of property values for this <code>DynaActionForm</code>,
      * keyed by property name.</p>
      */
     protected HashMap dynaValues = new HashMap();
 
-
     // ----------------------------------------------------- ActionForm Methods
 
-
     /**
      * <p>Initialize all bean properties to their initial values, as specified
      * in the {@link FormPropertyConfig} elements associated with the
@@ -82,13 +74,15 @@
      * @param mapping The mapping used to select this instance
      */
     public void initialize(ActionMapping mapping) {
-
         String name = mapping.getName();
+
         if (name == null) {
             return;
         }
+
         FormBeanConfig config =
-            mapping.getModuleConfig().findFormBeanConfig(name);
+                mapping.getModuleConfig().findFormBeanConfig(name);
+
         if (config == null) {
             return;
         }
@@ -102,25 +96,22 @@
      * @param config The configuration for the form bean to initialize.
      */
     public void initialize(FormBeanConfig config) {
-
         FormPropertyConfig[] props = config.findFormPropertyConfigs();
+
         for (int i = 0; i < props.length; i++) {
             set(props[i].getName(), props[i].initial());
         }
-
     }
 
-
     // :FIXME: Is there any point in retaining these reset methods
     // since they now simply replicate the superclass behavior?
 
     /**
-     * <p>Reset bean properties to their default state, as needed.
-     * This method is called before the properties are repopulated by
-     * the controller.</p>
+     * <p>Reset bean properties to their default state, as needed. This method
+     * is called before the properties are repopulated by the controller.</p>
      *
-     * <p>The default implementation attempts to forward to the HTTP
-     * version of this method.</p>
+     * <p>The default implementation attempts to forward to the HTTP version
+     * of this method.</p>
      *
      * @param mapping The mapping used to select this instance
      * @param request The servlet request we are processing
@@ -129,49 +120,54 @@
         super.reset(mapping, request);
     }
 
-
     /**
      * <p>Reset the properties to their <code>initial</code> value if their
-     * <code>reset</code> configuration is set to true or if <code>reset</code>
-     * is set to a list of HTTP request methods that includes the method of
-     * given <code>request</code> object.</p>
+     * <code>reset</code> configuration is set to true or if
+     * <code>reset</code> is set to a list of HTTP request methods that
+     * includes the method of given <code>request</code> object.</p>
      *
      * @param mapping The mapping used to select this instance
      * @param request The servlet request we are processing
      */
     public void reset(ActionMapping mapping, HttpServletRequest request) {
-        
         String name = getDynaClass().getName();
+
         if (name == null) {
             return;
         }
-        
-        FormBeanConfig config = 
+
+        FormBeanConfig config =
                 mapping.getModuleConfig().findFormBeanConfig(name);
+
         if (config == null) {
             return;
         }
-        
+
         // look for properties we should reset
         FormPropertyConfig[] props = config.findFormPropertyConfigs();
+
         for (int i = 0; i < props.length; i++) {
-            
             String resetValue = props[i].getReset();
-            // skip this property if there's no reset value 
+
+            // skip this property if there's no reset value
             if ((resetValue == null) || (resetValue.length() <= 0)) {
                 continue;
             }
-            
+
             boolean reset = Boolean.valueOf(resetValue).booleanValue();
+
             if (!reset) {
                 // check for the request method
-
                 // use a StringTokenizer with the default delimiters + a comma
-                StringTokenizer st = new StringTokenizer(resetValue, ", \t\n\r\f");
+                StringTokenizer st = new StringTokenizer(resetValue,
+                        ", \t\n\r\f");
+
                 while (st.hasMoreTokens()) {
                     String token = st.nextToken();
+
                     if (token.equalsIgnoreCase(request.getMethod())) {
                         reset = true;
+
                         break;
                     }
                 }
@@ -181,68 +177,63 @@
                 set(props[i].getName(), props[i].initial());
             }
         }
-        
     }
 
-
     // ------------------------------------------------------- DynaBean Methods
 
-
     /**
      * <p>Indicates if the specified mapped property contain a value for the
      * specified key value.</p>
      *
      * @param name Name of the property to check
-     * @param key Name of the key to check
-     *
+     * @param key  Name of the key to check
      * @return <code>true</code> if the specified mapped property contains a
-     *         value for the specified key value; <code>true</code> otherwise.
-     *
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
+     *         value for the specified key value; <code>true</code>
+     *         otherwise.
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
      */
     public boolean contains(String name, String key) {
-
         Object value = dynaValues.get(name);
+
         if (value == null) {
-            throw new NullPointerException
-                ("No mapped value for '" + name + "(" + key + ")'");
+            throw new NullPointerException(
+                    "No mapped value for '" + name + "("
+                            + key + ")'");
         } else if (value instanceof Map) {
             return (((Map) value).containsKey(key));
         } else {
-            throw new IllegalArgumentException
-                ("Non-mapped property for '" + name + "(" + key + ")'");
+            throw new IllegalArgumentException("Non-mapped property for '"
+                    + name + "(" + key + ")'");
         }
-
     }
 
-
     /**
      * <p>Return the value of a simple property with the specified name.</p>
      *
      * @param name Name of the property whose value is to be retrieved
-     *
      * @return The value of a simple property with the specified name.
-     *
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
-     * @exception NullPointerException if the type specified for the
-     *  property is invalid
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
+     * @throws NullPointerException     if the type specified for the property
+     *                                  is invalid
      */
     public Object get(String name) {
-
         // Return any non-null value for the specified property
         Object value = dynaValues.get(name);
+
         if (value != null) {
             return (value);
         }
 
         // Return a null value for a non-primitive property
         Class type = getDynaProperty(name).getType();
+
         if (type == null) {
-            throw new NullPointerException
-                ("The type for property " + name + " is invalid");
+            throw new NullPointerException("The type for property " + name
+                    + " is invalid");
         }
+
         if (!type.isPrimitive()) {
             return (value);
         }
@@ -267,140 +258,117 @@
         } else {
             return (null);
         }
-
     }
 
-
     /**
      * <p>Return the value of an indexed property with the specified name.
      * </p>
      *
-     * @param name Name of the property whose value is to be retrieved
+     * @param name  Name of the property whose value is to be retrieved
      * @param index Index of the value to be retrieved
-     *
      * @return The value of an indexed property with the specified name.
-     *
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
-     * @exception IllegalArgumentException if the specified property
-     *  exists, but is not indexed
-     * @exception IndexOutOfBoundsException if the specified index
-     *  is outside the range of the underlying property
-     * @exception NullPointerException if no array or List has been
-     *  initialized for this property
+     * @throws IllegalArgumentException  if there is no property of the
+     *                                   specified name
+     * @throws IllegalArgumentException  if the specified property exists, but
+     *                                   is not indexed
+     * @throws IndexOutOfBoundsException if the specified index is outside the
+     *                                   range of the underlying property
+     * @throws NullPointerException      if no array or List has been
+     *                                   initialized for this property
      */
     public Object get(String name, int index) {
-
         Object value = dynaValues.get(name);
+
         if (value == null) {
-            throw new NullPointerException
-                ("No indexed value for '" + name + "[" + index + "]'");
+            throw new NullPointerException("No indexed value for '" + name
+                    + "[" + index + "]'");
         } else if (value.getClass().isArray()) {
             return (Array.get(value, index));
         } else if (value instanceof List) {
             return ((List) value).get(index);
         } else {
-            throw new IllegalArgumentException
-                ("Non-indexed property for '" + name + "[" + index + "]'");
+            throw new IllegalArgumentException("Non-indexed property for '"
+                    + name + "[" + index + "]'");
         }
-
     }
 
-
     /**
-     * <p>Return the value of a mapped property with the specified name,
-     * or <code>null</code> if there is no value for the specified key.
-     * </p>
+     * <p>Return the value of a mapped property with the specified name, or
+     * <code>null</code> if there is no value for the specified key. </p>
      *
      * @param name Name of the property whose value is to be retrieved
-     * @param key Key of the value to be retrieved
-     *
+     * @param key  Key of the value to be retrieved
      * @return The value of a mapped property with the specified name, or
      *         <code>null</code> if there is no value for the specified key.
-     *
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
-     * @exception IllegalArgumentException if the specified property
-     *  exists, but is not mapped
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
+     * @throws IllegalArgumentException if the specified property exists, but
+     *                                  is not mapped
      */
     public Object get(String name, String key) {
-
         Object value = dynaValues.get(name);
+
         if (value == null) {
-            throw new NullPointerException
-                ("No mapped value for '" + name + "(" + key + ")'");
+            throw new NullPointerException(
+                    "No mapped value for '" + name + "("
+                            + key + ")'");
         } else if (value instanceof Map) {
             return (((Map) value).get(key));
         } else {
-            throw new IllegalArgumentException
-                ("Non-mapped property for '" + name + "(" + key + ")'");
+            throw new IllegalArgumentException("Non-mapped property for '"
+                    + name + "(" + key + ")'");
         }
-
     }
 
-
     /**
-     * <p>Return the value of a <code>String</code> property with the specified
-     * name. This is equivalent to calling
-     * <code>(String) dynaForm.get(name)</code>.</p>
+     * <p>Return the value of a <code>String</code> property with the
+     * specified name. This is equivalent to calling <code>(String)
+     * dynaForm.get(name)</code>.</p>
      *
      * @param name Name of the property whose value is to be retrieved.
-     *
      * @return The value of a <code>String</code> property with the specified
      *         name.
-     *
-     * @throws IllegalArgumentException if there is no property
-     *  of the specified name
-     * @throws NullPointerException if the type specified for the
-     *  property is invalid
-     * @throws ClassCastException if the property is not a String.
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
+     * @throws NullPointerException     if the type specified for the property
+     *                                  is invalid
+     * @throws ClassCastException       if the property is not a String.
      * @since Struts 1.2
      */
     public String getString(String name) {
-
         return (String) this.get(name);
-
     }
 
-
     /**
      * <p>Return the value of a <code>String[]</code> property with the
-     * specified name. This is equivalent to calling
-     * <code>(String[]) dynaForm.get(name)</code>.</p>
+     * specified name. This is equivalent to calling <code>(String[])
+     * dynaForm.get(name)</code>.</p>
      *
      * @param name Name of the property whose value is to be retrieved.
-     *
      * @return The value of a <code>String[]</code> property with the
      *         specified name.
-     *
-     * @throws IllegalArgumentException if there is no property
-     *  of the specified name
-     * @throws NullPointerException if the type specified for the
-     *  property is invalid
-     * @throws ClassCastException if the property is not a String[].
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
+     * @throws NullPointerException     if the type specified for the property
+     *                                  is invalid
+     * @throws ClassCastException       if the property is not a String[].
      * @since Struts 1.2
      */
     public String[] getStrings(String name) {
-
         return (String[]) this.get(name);
-
     }
 
-
     /**
-     * <p>Return the <code>DynaClass</code> instance that describes the set
-     * of properties available for this <code>DynaBean</code>.</p>
+     * <p>Return the <code>DynaClass</code> instance that describes the set of
+     * properties available for this <code>DynaBean</code>.</p>
      *
-     * @return The <code>DynaClass</code> instance that describes the set
-     *         of properties available for this <code>DynaBean</code>.
+     * @return The <code>DynaClass</code> instance that describes the set of
+     *         properties available for this <code>DynaBean</code>.
      */
     public DynaClass getDynaClass() {
-
         return (this.dynaClass);
-
     }
 
-
     /**
      * <p>Returns the <code>Map</code> containing the property values. This is
      * done mostly to facilitate accessing the <code>DynaActionForm</code>
@@ -421,221 +389,230 @@
      * @return The <code>Map</code> containing the property values.
      */
     public Map getMap() {
-
         return (dynaValues);
-
     }
 
-
     /**
-     * <p>Remove any existing value for the specified key on the
-     * specified mapped property.</p>
-     *
-     * @param name Name of the property for which a value is to
-     *  be removed
-     * @param key Key of the value to be removed
+     * <p>Remove any existing value for the specified key on the specified
+     * mapped property.</p>
      *
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
+     * @param name Name of the property for which a value is to be removed
+     * @param key  Key of the value to be removed
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
      */
     public void remove(String name, String key) {
-
         Object value = dynaValues.get(name);
+
         if (value == null) {
-            throw new NullPointerException
-                ("No mapped value for '" + name + "(" + key + ")'");
+            throw new NullPointerException(
+                    "No mapped value for '" + name + "("
+                            + key + ")'");
         } else if (value instanceof Map) {
             ((Map) value).remove(key);
         } else {
-            throw new IllegalArgumentException
-                ("Non-mapped property for '" + name + "(" + key + ")'");
+            throw new IllegalArgumentException("Non-mapped property for '"
+                    + name + "(" + key + ")'");
         }
-
     }
 
-
     /**
      * <p>Set the value of a simple property with the specified name.</p>
      *
-     * @param name Name of the property whose value is to be set
+     * @param name  Name of the property whose value is to be set
      * @param value Value to which this property is to be set
-     *
-     * @exception ConversionException if the specified value cannot be
-     *  converted to the type required for this property
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
-     * @exception NullPointerException if the type specified for the
-     *  property is invalid
-     * @exception NullPointerException if an attempt is made to set a
-     *  primitive property to null
+     * @throws ConversionException      if the specified value cannot be
+     *                                  converted to the type required for
+     *                                  this property
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
+     * @throws NullPointerException     if the type specified for the property
+     *                                  is invalid
+     * @throws NullPointerException     if an attempt is made to set a
+     *                                  primitive property to null
      */
     public void set(String name, Object value) {
-
         DynaProperty descriptor = getDynaProperty(name);
+
         if (descriptor.getType() == null) {
-            throw new NullPointerException
-                ("The type for property " + name + " is invalid");
+            throw new NullPointerException("The type for property " + name
+                    + " is invalid");
         }
+
         if (value == null) {
             if (descriptor.getType().isPrimitive()) {
-                throw new NullPointerException
-                    ("Primitive value for '" + name + "'");
+                throw new NullPointerException("Primitive value for '" + name
+                        + "'");
             }
-        } else if (!isDynaAssignable(descriptor.getType(), value.getClass())) {
+        } else
+        if (!isDynaAssignable(descriptor.getType(), value.getClass())) {
             throw new ConversionException("Cannot assign value of type '"
-                 + value.getClass().getName()
-                 + "' to property '" + name + "' of type '"
-                 + descriptor.getType().getName() + "'");
+                    + value.getClass().getName() + "' to property '" + name
+                    + "' of type '" + descriptor.getType().getName() + "'");
         }
-        dynaValues.put(name, value);
 
+        dynaValues.put(name, value);
     }
 
-
     /**
      * <p>Set the value of an indexed property with the specified name.</p>
      *
-     * @param name Name of the property whose value is to be set
+     * @param name  Name of the property whose value is to be set
      * @param index Index of the property to be set
      * @param value Value to which this property is to be set
-     *
-     * @exception ConversionException if the specified value cannot be
-     *  converted to the type required for this property
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
-     * @exception IllegalArgumentException if the specified property
-     *  exists, but is not indexed
-     * @exception IndexOutOfBoundsException if the specified index
-     *  is outside the range of the underlying property
+     * @throws ConversionException       if the specified value cannot be
+     *                                   converted to the type required for
+     *                                   this property
+     * @throws IllegalArgumentException  if there is no property of the
+     *                                   specified name
+     * @throws IllegalArgumentException  if the specified property exists, but
+     *                                   is not indexed
+     * @throws IndexOutOfBoundsException if the specified index is outside the
+     *                                   range of the underlying property
      */
     public void set(String name, int index, Object value) {
-
         Object prop = dynaValues.get(name);
+
         if (prop == null) {
-            throw new NullPointerException
-                ("No indexed value for '" + name + "[" + index + "]'");
+            throw new NullPointerException("No indexed value for '" + name
+                    + "[" + index + "]'");
         } else if (prop.getClass().isArray()) {
             Array.set(prop, index, value);
         } else if (prop instanceof List) {
             try {
                 ((List) prop).set(index, value);
-            } catch (ClassCastException e) {
+            }
+            catch (ClassCastException e) {
                 throw new ConversionException(e.getMessage());
             }
         } else {
-            throw new IllegalArgumentException
-                ("Non-indexed property for '" + name + "[" + index + "]'");
+            throw new IllegalArgumentException("Non-indexed property for '"
+                    + name + "[" + index + "]'");
         }
-
     }
 
-
     /**
      * <p>Set the value of a mapped property with the specified name.</p>
      *
-     * @param name Name of the property whose value is to be set
-     * @param key Key of the property to be set
+     * @param name  Name of the property whose value is to be set
+     * @param key   Key of the property to be set
      * @param value Value to which this property is to be set
-     *
-     * @exception ConversionException if the specified value cannot be
-     *  converted to the type required for this property
-     * @exception IllegalArgumentException if there is no property
-     *  of the specified name
-     * @exception IllegalArgumentException if the specified property
-     *  exists, but is not mapped
+     * @throws ConversionException      if the specified value cannot be
+     *                                  converted to the type required for
+     *                                  this property
+     * @throws IllegalArgumentException if there is no property of the
+     *                                  specified name
+     * @throws IllegalArgumentException if the specified property exists, but
+     *                                  is not mapped
      */
     public void set(String name, String key, Object value) {
-
         Object prop = dynaValues.get(name);
+
         if (prop == null) {
-            throw new NullPointerException
-                ("No mapped value for '" + name + "(" + key + ")'");
+            throw new NullPointerException(
+                    "No mapped value for '" + name + "("
+                            + key + ")'");
         } else if (prop instanceof Map) {
             ((Map) prop).put(key, value);
         } else {
-            throw new IllegalArgumentException
-                ("Non-mapped property for '" + name + "(" + key + ")'");
+            throw new IllegalArgumentException("Non-mapped property for '"
+                    + name + "(" + key + ")'");
         }
-
     }
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * <p>Render a String representation of this object.</p>
      *
      * @return A string representation of this object.
      */
     public String toString() {
-
         StringBuffer sb = new StringBuffer("DynaActionForm[dynaClass=");
         DynaClass dynaClass = getDynaClass();
+
         if (dynaClass == null) {
             return sb.append("null]").toString();
         }
 
         sb.append(dynaClass.getName());
+
         DynaProperty[] props = dynaClass.getDynaProperties();
+
         if (props == null) {
             props = new DynaProperty[0];
         }
+
         for (int i = 0; i < props.length; i++) {
             sb.append(',');
             sb.append(props[i].getName());
             sb.append('=');
+
             Object value = get(props[i].getName());
+
             if (value == null) {
                 sb.append("<NULL>");
             } else if (value.getClass().isArray()) {
                 int n = Array.getLength(value);
+
                 sb.append("{");
+
                 for (int j = 0; j < n; j++) {
                     if (j > 0) {
                         sb.append(',');
                     }
+
                     sb.append(Array.get(value, j));
                 }
+
                 sb.append("}");
             } else if (value instanceof List) {
                 int n = ((List) value).size();
+
                 sb.append("{");
+
                 for (int j = 0; j < n; j++) {
                     if (j > 0) {
                         sb.append(',');
                     }
+
                     sb.append(((List) value).get(j));
                 }
+
                 sb.append("}");
             } else if (value instanceof Map) {
                 int n = 0;
                 Iterator keys = ((Map) value).keySet().iterator();
+
                 sb.append("{");
+
                 while (keys.hasNext()) {
                     if (n > 0) {
                         sb.append(',');
                     }
+
                     n++;
+
                     Object key = keys.next();
+
                     sb.append(key);
                     sb.append('=');
                     sb.append(((Map) value).get(key));
                 }
+
                 sb.append("}");
             } else {
                 sb.append(value);
             }
         }
+
         sb.append("]");
-        return (sb.toString());
 
+        return (sb.toString());
     }
 
-
     // -------------------------------------------------------- Package Methods
 
-
     /**
      * <p>Set the <code>DynaActionFormClass</code> instance with which we are
      * associated.</p>
@@ -643,49 +620,41 @@
      * @param dynaClass The DynaActionFormClass instance for this bean
      */
     void setDynaActionFormClass(DynaActionFormClass dynaClass) {
-
         this.dynaClass = dynaClass;
-
     }
 
-
     // ------------------------------------------------------ Protected Methods
 
-
     /**
      * <p>Return the property descriptor for the specified property name.</p>
      *
      * @param name Name of the property for which to retrieve the descriptor
-     *
      * @return The property descriptor for the specified property name.
-     *
-     * @exception IllegalArgumentException if this is not a valid property
-     *  name for our DynaClass
+     * @throws IllegalArgumentException if this is not a valid property name
+     *                                  for our DynaClass
      */
     protected DynaProperty getDynaProperty(String name) {
-
         DynaProperty descriptor = getDynaClass().getDynaProperty(name);
+
         if (descriptor == null) {
-            throw new IllegalArgumentException
-                ("Invalid property name '" + name + "'");
+            throw new IllegalArgumentException(
+                    "Invalid property name '" + name
+                            + "'");
         }
-        return (descriptor);
 
+        return (descriptor);
     }
 
-
     /**
      * <p>Indicates if an object of the source class is assignable to the
      * destination class.</p>
      *
-     * @param dest Destination class
+     * @param dest   Destination class
      * @param source Source class
-     *
-     * @return <code>true</code> if the source is assignable to the destination;
-     *         <code>false</code> otherwise.
+     * @return <code>true</code> if the source is assignable to the
+     *         destination; <code>false</code> otherwise.
      */
     protected boolean isDynaAssignable(Class dest, Class source) {
-
         if (dest.isAssignableFrom(source)
                 || ((dest == Boolean.TYPE) && (source == Boolean.class))
                 || ((dest == Byte.TYPE) && (source == Byte.class))
@@ -699,8 +668,5 @@
         } else {
             return (false);
         }
-
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java Fri Jan 20 16:19:02 2006
@@ -15,14 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.struts.action;
 
-
-import java.io.Serializable;
-import java.util.HashMap;
-
 import org.apache.commons.beanutils.DynaBean;
 import org.apache.commons.beanutils.DynaClass;
 import org.apache.commons.beanutils.DynaProperty;
@@ -32,74 +26,46 @@
 import org.apache.struts.config.FormPropertyConfig;
 import org.apache.struts.util.RequestUtils;
 
+import java.io.Serializable;
+import java.util.HashMap;
 
 /**
- * <p>Implementation of <code>DynaClass</code> for
- * <code>DynaActionForm</code> classes that allow developers to define
- * ActionForms without having to individually code all of the classes.
- * <strong>NOTE</strong> - This class is only used in the internal
- * implementation of dynamic action form beans. Application developers
- * never need to consult this documentation.</p>
+ * <p>Implementation of <code>DynaClass</code> for <code>DynaActionForm</code>
+ * classes that allow developers to define ActionForms without having to
+ * individually code all of the classes. <strong>NOTE</strong> - This class is
+ * only used in the internal implementation of dynamic action form beans.
+ * Application developers never need to consult this documentation.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2006-01-17 07:26:20 -0500 (Tue, 17 Jan 2006)
+ *          $
  * @since Struts 1.1
  */
-
 public class DynaActionFormClass implements DynaClass, Serializable {
-
     private static Log log = LogFactory.getLog(DynaActionFormClass.class);
 
-    // ----------------------------------------------------------- Constructors
-
-
-    /**
-     * <p>Construct a new <code>DynaActionFormClass</code> for the specified
-     * form bean configuration.  This constructor is private;
-     * <code>DynaActionFormClass</code> instances will be created as needed via
-     * calls to the static <code>createDynaActionFormClass()</code> method.</p>
-     *
-     * @param config The FormBeanConfig instance describing the properties
-     *  of the bean to be created
-     *
-     * @exception IllegalArgumentException if the bean implementation class
-     *  specified in the configuration is not DynaActionForm (or a subclass
-     *  of DynaActionForm)
-     */
-    public DynaActionFormClass(FormBeanConfig config) {
-
-        introspect(config);
-
-    }
-
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * <p>The <code>DynaActionForm</code> implementation <code>Class</code>
      * which we will use to create new bean instances.</p>
      */
     protected transient Class beanClass = null;
 
-
     /**
      * <p>The form bean configuration information for this class.</p>
      */
     protected FormBeanConfig config = null;
 
-
     /**
      * <p>The "dynamic class name" for this <code>DynaClass</code>.</p>
      */
     protected String name = null;
 
-
     /**
      * <p>The set of dynamic properties that are part of this DynaClass.</p>
      */
     protected DynaProperty[] properties = null;
 
-
     /**
      * <p>The set of dynamic properties that are part of this
      * <code>DynaClass</code>, keyed by the property name.  Individual
@@ -108,9 +74,27 @@
      */
     protected HashMap propertiesMap = new HashMap();
 
+    // ----------------------------------------------------------- Constructors
 
-    // ------------------------------------------------------ DynaClass Methods
+    /**
+     * <p>Construct a new <code>DynaActionFormClass</code> for the specified
+     * form bean configuration.  This constructor is private;
+     * <code>DynaActionFormClass</code> instances will be created as needed
+     * via calls to the static <code>createDynaActionFormClass()</code>
+     * method.</p>
+     *
+     * @param config The FormBeanConfig instance describing the properties of
+     *               the bean to be created
+     * @throws IllegalArgumentException if the bean implementation class
+     *                                  specified in the configuration is not
+     *                                  DynaActionForm (or a subclass of
+     *                                  DynaActionForm)
+     */
+    public DynaActionFormClass(FormBeanConfig config) {
+        introspect(config);
+    }
 
+    // ------------------------------------------------------ DynaClass Methods
 
     /**
      * <p>Return the name of this <code>DynaClass</code> (analogous to the
@@ -121,34 +105,26 @@
      * @return The name of this <code>DynaClass</code>.
      */
     public String getName() {
-
         return (this.name);
-
     }
 
-
     /**
-     * <p>Return a property descriptor for the specified property, if it exists;
-     * otherwise, return <code>null</code>.</p>
-     *
-     * @param name Name of the dynamic property for which a descriptor
-     *  is requested
+     * <p>Return a property descriptor for the specified property, if it
+     * exists; otherwise, return <code>null</code>.</p>
      *
+     * @param name Name of the dynamic property for which a descriptor is
+     *             requested
      * @return A property descriptor for the specified property.
-     *
-     * @exception IllegalArgumentException if no property name is specified
+     * @throws IllegalArgumentException if no property name is specified
      */
     public DynaProperty getDynaProperty(String name) {
-
         if (name == null) {
-            throw new IllegalArgumentException
-                ("No property name specified");
+            throw new IllegalArgumentException("No property name specified");
         }
-        return ((DynaProperty) propertiesMap.get(name));
 
+        return ((DynaProperty) propertiesMap.get(name));
     }
 
-
     /**
      * <p>Return an array of <code>DynaProperty</code>s for the properties
      * currently defined in this <code>DynaClass</code>.  If no properties are
@@ -157,94 +133,90 @@
      * @return An array of property instances for this class.
      */
     public DynaProperty[] getDynaProperties() {
-
         return (properties);
+
         // :FIXME: Should we really be implementing
         // getBeanInfo instead, which returns property descriptors
         // and a bunch of other stuff?
-
     }
 
-
     /**
      * <p>Instantiate and return a new {@link DynaActionForm} instance,
-     * associated with this <code>DynaActionFormClass</code>.  The
-     * properties of the returned {@link DynaActionForm} will have been
-     * initialized to the default values specified in the form bean
-     * configuration information.</p>
+     * associated with this <code>DynaActionFormClass</code>.  The properties
+     * of the returned {@link DynaActionForm} will have been initialized to
+     * the default values specified in the form bean configuration
+     * information.</p>
      *
      * @return A new {@link DynaActionForm} instance.
-     *
-     * @exception IllegalAccessException if the Class or the appropriate
-     *  constructor is not accessible
-     * @exception InstantiationException if this Class represents an abstract
-     *  class, an array class, a primitive type, or void; or if instantiation
-     *  fails for some other reason
+     * @throws IllegalAccessException if the Class or the appropriate
+     *                                constructor is not accessible
+     * @throws InstantiationException if this Class represents an abstract
+     *                                class, an array class, a primitive type,
+     *                                or void; or if instantiation fails for
+     *                                some other reason
      */
     public DynaBean newInstance()
-        throws IllegalAccessException, InstantiationException {
+            throws IllegalAccessException, InstantiationException {
+        DynaActionForm dynaBean =
+                (DynaActionForm) getBeanClass().newInstance();
 
-        DynaActionForm dynaBean = (DynaActionForm) getBeanClass().newInstance();
         dynaBean.setDynaActionFormClass(this);
+
         FormPropertyConfig[] props = config.findFormPropertyConfigs();
+
         for (int i = 0; i < props.length; i++) {
             dynaBean.set(props[i].getName(), props[i].initial());
         }
-        return (dynaBean);
 
+        return (dynaBean);
     }
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * <p>Render a <code>String</code> representation of this object.</p>
      *
      * @return The string representation of this instance.
      */
     public String toString() {
-
         StringBuffer sb = new StringBuffer("DynaActionFormBean[name=");
+
         sb.append(name);
+
         DynaProperty[] props = getDynaProperties();
+
         if (props == null) {
             props = new DynaProperty[0];
         }
+
         for (int i = 0; i < props.length; i++) {
             sb.append(',');
             sb.append(props[i].getName());
             sb.append('/');
             sb.append(props[i].getType());
         }
+
         sb.append("]");
-        return (sb.toString());
 
+        return (sb.toString());
     }
 
-
     // --------------------------------------------------------- Static Methods
 
-
     /**
      * Return the <code>DynaActionFormClass</code> instance for the specified
      * form bean configuration instance.
      *
      * @param config The config for which the class should be created.
-     *
      * @return The instance for the specified form bean config.
      */
     public static DynaActionFormClass createDynaActionFormClass(
             FormBeanConfig config) {
-
         return config.getDynaActionFormClass();
-
     }
 
-
     // ------------------------------------------------------ Protected Methods
 
-
     /**
      * <p>Return the implementation class we are using to construct new
      * instances, re-introspecting our {@link FormBeanConfig} if necessary
@@ -254,41 +226,41 @@
      * @return The implementation class used to construct new instances.
      */
     protected Class getBeanClass() {
-
         if (beanClass == null) {
             introspect(config);
         }
-        return (beanClass);
 
+        return (beanClass);
     }
 
-
     /**
      * <p>Introspect our form bean configuration to identify the supported
      * properties.</p>
      *
-     * @param config The FormBeanConfig instance describing the properties
-     *  of the bean to be created
-     *
-     * @exception IllegalArgumentException if the bean implementation class
-     *  specified in the configuration is not DynaActionForm (or a subclass
-     *  of DynaActionForm)
+     * @param config The FormBeanConfig instance describing the properties of
+     *               the bean to be created
+     * @throws IllegalArgumentException if the bean implementation class
+     *                                  specified in the configuration is not
+     *                                  DynaActionForm (or a subclass of
+     *                                  DynaActionForm)
      */
     protected void introspect(FormBeanConfig config) {
-
         this.config = config;
 
         // Validate the ActionFormBean implementation class
         try {
             beanClass = RequestUtils.applicationClass(config.getType());
-        } catch (Throwable t) {
+        }
+        catch (Throwable t) {
             throw new IllegalArgumentException(
                     "Cannot instantiate ActionFormBean class '"
-                    + config.getType() + "': " + t);
+                            + config.getType()
+                            + "': " + t);
         }
+
         if (!DynaActionForm.class.isAssignableFrom(beanClass)) {
-            throw new IllegalArgumentException(
-                    "Class '" + config.getType() + "' is not a subclass of "
+            throw new IllegalArgumentException("Class '" + config.getType()
+                    + "' is not a subclass of "
                     + "'org.apache.struts.action.DynaActionForm'");
         }
 
@@ -297,23 +269,20 @@
 
         // Look up the property descriptors for this bean class
         FormPropertyConfig[] descriptors = config.findFormPropertyConfigs();
+
         if (descriptors == null) {
             descriptors = new FormPropertyConfig[0];
         }
 
         // Create corresponding dynamic property definitions
         properties = new DynaProperty[descriptors.length];
+
         for (int i = 0; i < descriptors.length; i++) {
-            properties[i] =
-                new DynaProperty(descriptors[i].getName(),
-                                 descriptors[i].getTypeClass());
-            propertiesMap.put(properties[i].getName(),
-                              properties[i]);
+            properties[i] = new DynaProperty(descriptors[i].getName(),
+                    descriptors[i].getTypeClass());
+            propertiesMap.put(properties[i].getName(), properties[i]);
         }
-
     }
 
-
     // -------------------------------------------------------- Private Methods
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/action/ExceptionHandler.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/ExceptionHandler.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/ExceptionHandler.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/ExceptionHandler.java Fri Jan 20 16:19:02 2006
@@ -15,16 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.action;
 
-import java.io.IOException;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.Globals;
@@ -32,19 +24,26 @@
 import org.apache.struts.util.MessageResources;
 import org.apache.struts.util.ModuleException;
 
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
 /**
  * <p>An <strong>ExceptionHandler</strong> is configured in the Struts
- * configuration file to handle a specific type of exception thrown
- * by an <code>Action.execute</code> method.</p>
+ * configuration file to handle a specific type of exception thrown by an
+ * <code>Action.execute</code> method.</p>
  *
  * @since Struts 1.1
  */
 public class ExceptionHandler {
-
     /**
-     * <p>The name of a configuration property which can be set to specify an alternative path which should be used
-     * when the <code>HttpServletResponse</code> has already been committed.</p>
-     * <p>To use this, in your <code>struts-config.xml</code> specify the exception handler like this:
+     * <p>The name of a configuration property which can be set to specify an
+     * alternative path which should be used when the <code>HttpServletResponse</code>
+     * has already been committed.</p> <p>To use this, in your
+     * <code>struts-config.xml</code> specify the exception handler like
+     * this:
      * <pre>
      *   &lt;exception
      *       key="GlobalExceptionHandler.default"
@@ -53,21 +52,26 @@
      *       &lt;set-property key="INCLUDE_PATH" value="/error.jsp" /&gt;
      *   &lt;/exception&gt;
      *  </pre>
-     * </p>
-     * <p>You would want to use this when your normal ExceptionHandler path is a Tiles definition or otherwise unsuitable for use
-     * in an <code>include</code> context.  If you do not use this, and you do not specify "SILENT_IF_COMMITTED" then the
-     * ExceptionHandler will attempt to forward to the same path which would be used in normal circumstances,
-     * specified using the "path" attribute in the &lt;exception&gt; element.</p>
+     * </p> <p>You would want to use this when your normal ExceptionHandler
+     * path is a Tiles definition or otherwise unsuitable for use in an
+     * <code>include</code> context.  If you do not use this, and you do not
+     * specify "SILENT_IF_COMMITTED" then the ExceptionHandler will attempt to
+     * forward to the same path which would be used in normal circumstances,
+     * specified using the "path" attribute in the &lt;exception&gt;
+     * element.</p>
+     *
      * @since Struts 1.3
      */
     public static final String INCLUDE_PATH = "INCLUDE_PATH";
 
     /**
-     * <p>The name of a configuration property which indicates that Struts should do nothing 
-     * if the response has already been committed.  This suppresses the default behavior, which is
-     * to use an "include" rather than a "forward" in this case in hopes of providing some meaningful
-     * information to the browser.</p>
-     * <p>To use this, in your <code>struts-config.xml</code> specify the exception handler like this:
+     * <p>The name of a configuration property which indicates that Struts
+     * should do nothing if the response has already been committed.  This
+     * suppresses the default behavior, which is to use an "include" rather
+     * than a "forward" in this case in hopes of providing some meaningful
+     * information to the browser.</p> <p>To use this, in your
+     * <code>struts-config.xml</code> specify the exception handler like
+     * this:
      * <pre>
      *   &lt;exception
      *       key="GlobalExceptionHandler.default"
@@ -76,11 +80,12 @@
      *       &lt;set-property key="SILENT_IF_COMMITTED" value="true" /&gt;
      *   &lt;/exception&gt;
      *  </pre>
-     * To be effective, this value must be defined to the literal String "true".  If it is not defined or
-     * defined to any other value, the default behavior will be used.
-     * </p>
-     * <p>You only need to use this if you do not want error information displayed in the browser when Struts
+     * To be effective, this value must be defined to the literal String
+     * "true".  If it is not defined or defined to any other value, the
+     * default behavior will be used. </p> <p>You only need to use this if you
+     * do not want error information displayed in the browser when Struts
      * intercepts an exception after the response has been committed.</p>
+     *
      * @since Struts 1.3
      */
     public static final String SILENT_IF_COMMITTED = "SILENT_IF_COMMITTED";
@@ -90,44 +95,36 @@
      */
     private static final Log log = LogFactory.getLog(ExceptionHandler.class);
 
-
     /**
      * <p>The message resources for this package.</p>
      */
-    private static MessageResources messages =
-        MessageResources.getMessageResources(
-            "org.apache.struts.action.LocalStrings");
-
+    private static MessageResources messages = MessageResources
+            .getMessageResources("org.apache.struts.action.LocalStrings");
 
     /**
-     * <p>Handle the <code>Exception</code>.
-     * Return the <code>ActionForward</code> instance (if any) returned by
-     * the called <code>ExceptionHandler</code>.
+     * <p>Handle the <code>Exception</code>. Return the
+     * <code>ActionForward</code> instance (if any) returned by the called
+     * <code>ExceptionHandler</code>.
      *
-     * @param ex The exception to handle
-     * @param ae The ExceptionConfig corresponding to the exception
-     * @param mapping The ActionMapping we are processing
+     * @param ex           The exception to handle
+     * @param ae           The ExceptionConfig corresponding to the exception
+     * @param mapping      The ActionMapping we are processing
      * @param formInstance The ActionForm we are processing
-     * @param request The servlet request we are processing
-     * @param response The servlet response we are creating
-     *
+     * @param request      The servlet request we are processing
+     * @param response     The servlet response we are creating
      * @return The <code>ActionForward</code> instance (if any) returned by
      *         the called <code>ExceptionHandler</code>.
-     *
-     * @exception ServletException if a servlet exception occurs
-     *
+     * @throws ServletException if a servlet exception occurs
      * @since Struts 1.1
      */
-    public ActionForward execute(
-        Exception ex,
-        ExceptionConfig ae,
-        ActionMapping mapping,
-        ActionForm formInstance,
-        HttpServletRequest request,
-        HttpServletResponse response)
-        throws ServletException {
-
+    public ActionForward execute(Exception ex, ExceptionConfig ae,
+                                 ActionMapping mapping,
+                                 ActionForm formInstance,
+                                 HttpServletRequest request,
+                                 HttpServletResponse response)
+            throws ServletException {
         log.debug("ExceptionHandler executing for exception " + ex);
+
         ActionForward forward = null;
         ActionMessage error = null;
         String property = null;
@@ -154,21 +151,32 @@
         // Store the exception
         request.setAttribute(Globals.EXCEPTION_KEY, ex);
         this.storeException(request, property, error, forward, ae.getScope());
-        if (!response.isCommitted()) return forward;
-        log.debug("Response is already committed, so forwarding will not work.  Attempt alternate handling.");
+
+        if (!response.isCommitted()) {
+            return forward;
+        }
+
+        log.debug(
+                "Response is already committed, so forwarding will not work.  Attempt alternate handling.");
+
         if (!silent(ae)) {
-            handleCommittedResponse(ex, ae, mapping, formInstance, request,response, forward);
+            handleCommittedResponse(ex, ae, mapping, formInstance, request,
+                    response, forward);
         } else {
-            log.warn("ExceptionHandler configured with " + SILENT_IF_COMMITTED + " and response is committed.",ex);
+            log.warn("ExceptionHandler configured with " + SILENT_IF_COMMITTED
+                    + " and response is committed.", ex);
         }
-        return null;
 
+        return null;
     }
 
     /**
-     * <p>Attempt to give good information when the response has already been committed when the exception was thrown.
-     * This happens often when Tiles is used. Base implementation will see if the INCLUDE_PATH property has been set,
-     * or if not, it will attempt to use the same path to which control would have been forwarded.</p> 
+     * <p>Attempt to give good information when the response has already been
+     * committed when the exception was thrown. This happens often when Tiles
+     * is used. Base implementation will see if the INCLUDE_PATH property has
+     * been set, or if not, it will attempt to use the same path to which
+     * control would have been forwarded.</p>
+     *
      * @param ex
      * @param config
      * @param mapping
@@ -178,100 +186,118 @@
      * @param actionForward
      * @since Struts 1.3
      */
-    protected void handleCommittedResponse(
-            Exception ex,
-            ExceptionConfig config,
-            ActionMapping mapping,
-            ActionForm formInstance,
-            HttpServletRequest request,
-            HttpServletResponse response,
-            ActionForward actionForward) {
+    protected void handleCommittedResponse(Exception ex,
+                                           ExceptionConfig config,
+                                           ActionMapping mapping,
+                                           ActionForm formInstance,
+                                           HttpServletRequest request,
+                                           HttpServletResponse response,
+                                           ActionForward actionForward) {
         String includePath = determineIncludePath(config, actionForward);
+
         if (includePath != null) {
             if (includePath.startsWith("/")) {
-                log.debug("response committed, but attempt to include results of actionForward path");
-                RequestDispatcher requestDispatcher = request.getRequestDispatcher(includePath);
+                log.debug(
+                        "response committed, but attempt to include results of actionForward path");
+
+                RequestDispatcher requestDispatcher = request
+                        .getRequestDispatcher(includePath);
+
                 try {
                     requestDispatcher.include(request, response);
+
                     return;
-                } catch (IOException e) {
-                    log.error("IOException when trying to include the error page path " + includePath,e);
-                } catch (ServletException e) {
-                    log.error("ServletException when trying to include the error page path " + includePath,e);
+                }
+                catch (IOException e) {
+                    log.error(
+                            "IOException when trying to include the error page path "
+                                    + includePath,
+                            e);
+                }
+                catch (ServletException e) {
+                    log.error(
+                            "ServletException when trying to include the error page path "
+                                    + includePath,
+                            e);
                 }
             } else {
-                log.warn("Suspicious includePath doesn't seem likely to work, so skipping it: " + includePath + "; expected path to start with '/'");
+                log.warn(
+                        "Suspicious includePath doesn't seem likely to work, so skipping it: "
+                                + includePath
+                                + "; expected path to start with '/'");
             }
-        } 
-        log.debug("Include not available or failed; try writing to the response directly.");
+        }
+
+        log.debug(
+                "Include not available or failed; try writing to the response directly.");
+
         try {
             response.getWriter().println("Unexpected error: " + ex);
             response.getWriter().println("<!-- ");
             ex.printStackTrace(response.getWriter());
             response.getWriter().println("-->");
-        } catch (IOException e) {
+        }
+        catch (IOException e) {
             log.error("Error giving minimal information about exception", e);
             log.error("Original exception: ", ex);
         }
-
     }
 
-
     /**
-     * <p>Return a path to which an include should be attempted in the case when the response was committed
-     * before the <code>ExceptionHandler</code> was invoked.  </p>
-     * <p>If the <code>ExceptionConfig</code> has the property <code>INCLUDE_PATH</code> defined, then the value
-     * of that property will be returned.</p>
+     * <p>Return a path to which an include should be attempted in the case
+     * when the response was committed before the <code>ExceptionHandler</code>
+     * was invoked.  </p> <p>If the <code>ExceptionConfig</code> has the
+     * property <code>INCLUDE_PATH</code> defined, then the value of that
+     * property will be returned.</p>
+     *
      * @param config
      * @param actionForward
      * @return
      * @since Struts 1.3
      */
-    protected String determineIncludePath(ExceptionConfig config, ActionForward actionForward) {
-        String includePath = config.getProperty("INCLUDE_PATH"); 
+    protected String determineIncludePath(ExceptionConfig config,
+                                          ActionForward actionForward) {
+        String includePath = config.getProperty("INCLUDE_PATH");
+
         if (includePath == null) {
             includePath = actionForward.getPath();
         }
+
         return includePath;
     }
 
     /**
      * <p>Logs the <code>Exception</code> using commons-logging.</p>
+     *
      * @param e The Exception to log.
      * @since Struts 1.2
      */
     protected void logException(Exception e) {
-
         log.debug(messages.getMessage("exception.log"), e);
-
     }
 
-
     /**
      * <p>Default implementation for handling an <code>ActionMessage</code>
      * generated from an <code>Exception</code> during <code>Action</code>
      * delegation. The default implementation is to set an attribute of the
-     * request or session, as defined by the scope provided (the scope from the
-     * exception mapping). An <code>ActionMessages</code> instance is created,
-     * the error is added to the collection and the collection is set under the
-     * <code>Globals.ERROR_KEY</code>.</p>
+     * request or session, as defined by the scope provided (the scope from
+     * the exception mapping). An <code>ActionMessages</code> instance is
+     * created, the error is added to the collection and the collection is set
+     * under the <code>Globals.ERROR_KEY</code>.</p>
      *
-     * @param request The request we are handling
+     * @param request  The request we are handling
      * @param property The property name to use for this error
-     * @param error The error generated from the exception mapping
-     * @param forward The forward generated from the input path (from the form
-     *                or exception mapping)
-     * @param scope The scope of the exception mapping.
+     * @param error    The error generated from the exception mapping
+     * @param forward  The forward generated from the input path (from the
+     *                 form or exception mapping)
+     * @param scope    The scope of the exception mapping.
      * @since Struts 1.2
      */
-    protected void storeException(
-        HttpServletRequest request,
-        String property,
-        ActionMessage error,
-        ActionForward forward,
-        String scope) {
-
+    protected void storeException(HttpServletRequest request, String property,
+                                  ActionMessage error, ActionForward forward,
+                                  String scope) {
         ActionMessages errors = new ActionMessages();
+
         errors.add(property, error);
 
         if ("request".equals(scope)) {
@@ -282,8 +308,11 @@
     }
 
     /**
-     * <p>Indicate whether this Handler has been configured to be silent.  In the base implementation, this is
-     * done by specifying the value <code>"true"</code> for the property "SILENT_IF_COMMITTED" in the ExceptionConfig.</p>
+     * <p>Indicate whether this Handler has been configured to be silent.  In
+     * the base implementation, this is done by specifying the value
+     * <code>"true"</code> for the property "SILENT_IF_COMMITTED" in the
+     * ExceptionConfig.</p>
+     *
      * @param config
      * @return
      * @since Struts 1.3
@@ -292,4 +321,3 @@
         return "true".equals(config.getProperty(SILENT_IF_COMMITTED));
     }
 }
-

Modified: struts/action/trunk/src/java/org/apache/struts/action/ForwardingActionForward.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/ForwardingActionForward.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/ForwardingActionForward.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/ForwardingActionForward.java Fri Jan 20 16:19:02 2006
@@ -15,8 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.struts.action;
 
 
@@ -24,38 +22,28 @@
  * <p>A subclass of <code>ActionForward</code> that defaults the
  * <code>redirect</code> attribute to <code>false</code>.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class ForwardingActionForward extends ActionForward {
-
-
     // ----------------------------------------------------------- Constructors
 
-
     /**
      * <p>Construct a new instance with default values.</p>
      */
     public ForwardingActionForward() {
-
         this(null);
-
     }
 
-
     /**
      * <P>Construct a new instance with the specified path.</p>
      *
      * @param path Path for this instance
      */
     public ForwardingActionForward(String path) {
-
         super();
         setName(null);
         setPath(path);
         setRedirect(false);
-
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/action/PlugIn.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/PlugIn.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/PlugIn.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/PlugIn.java Fri Jan 20 16:19:02 2006
@@ -15,14 +15,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.struts.action;
 
-
-import javax.servlet.ServletException;
 import org.apache.struts.config.ModuleConfig;
 
+import javax.servlet.ServletException;
 
 /**
  * <p>A <strong>PlugIn</strong> is a configuration wrapper for a
@@ -34,42 +31,36 @@
  * need to subclass {@link ActionServlet} simply to perform application
  * lifecycle activities.</p>
  *
- * <p>Implementations of this interface must supply a zero-argument constructor
- * for use by {@link ActionServlet}. Configuration can be accomplished by
- * providing standard JavaBeans property setter methods, which will all have
- * been called before the <code>init()</code> method is invoked.</p>
+ * <p>Implementations of this interface must supply a zero-argument
+ * constructor for use by {@link ActionServlet}. Configuration can be
+ * accomplished by providing standard JavaBeans property setter methods, which
+ * will all have been called before the <code>init()</code> method is
+ * invoked.</p>
  *
- * <p>This interface can be applied to any class, including an Action subclass.
- * </p>
+ * <p>This interface can be applied to any class, including an Action
+ * subclass. </p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-14 01:09:32 -0400 (Sat, 14 May 2005)
+ *          $
  * @since Struts 1.1
  */
-
 public interface PlugIn {
-
-
     /**
-     * <p>Receive notification that our owning module is being
-     * shut down.</p>
+     * <p>Receive notification that our owning module is being shut down.</p>
      */
     void destroy();
 
-
     /**
-     * <p>Receive notification that the specified module is being
-     * started up.</p>
+     * <p>Receive notification that the specified module is being started
+     * up.</p>
      *
-     * @param servlet ActionServlet that is managing all the
-     *  modules in this web application
-     * @param config ModuleConfig for the module with which
-     *  this plug-in is associated
-     *
-     * @exception ServletException if this <code>PlugIn</code> cannot
-     *  be successfully initialized
+     * @param servlet ActionServlet that is managing all the modules in this
+     *                web application
+     * @param config  ModuleConfig for the module with which this plug-in is
+     *                associated
+     * @throws ServletException if this <code>PlugIn</code> cannot be
+     *                          successfully initialized
      */
     void init(ActionServlet servlet, ModuleConfig config)
-        throws ServletException;
-
-
+            throws ServletException;
 }

Modified: struts/action/trunk/src/java/org/apache/struts/action/RedirectingActionForward.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/RedirectingActionForward.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/RedirectingActionForward.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/RedirectingActionForward.java Fri Jan 20 16:19:02 2006
@@ -15,8 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.struts.action;
 
 
@@ -24,38 +22,28 @@
  * <p>A subclass of <strong>ActionForward</strong> that defaults the
  * <code>redirect</code> attribute to <code>true</code>.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class RedirectingActionForward extends ActionForward {
-
-
     // ----------------------------------------------------------- Constructors
 
-
     /**
      * <p>Construct a new instance with default values.</p>
      */
     public RedirectingActionForward() {
-
-       this(null);
-
+        this(null);
     }
 
-
     /**
      * <p>Construct a new instance with the specified path.</p>
      *
      * @param path Path for this instance
      */
     public RedirectingActionForward(String path) {
-
         super();
         setName(null);
         setPath(path);
         setRedirect(true);
-
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/action/RequestActionMapping.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/RequestActionMapping.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/RequestActionMapping.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/RequestActionMapping.java Fri Jan 20 16:19:02 2006
@@ -15,30 +15,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.struts.action;
 
 
 /**
- * <p>Subclass of <code>ActionMapping</code> that defaults the form bean
- * scope to <code>request</code>.</p>
+ * <p>Subclass of <code>ActionMapping</code> that defaults the form bean scope
+ * to <code>request</code>.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class RequestActionMapping extends ActionMapping {
-
-
     /**
-     * <p>Construct a new instance of this class with the desired default
-     * form bean scope.</p>
+     * <p>Construct a new instance of this class with the desired default form
+     * bean scope.</p>
      */
     public RequestActionMapping() {
-
         super();
         setScope("request");
-
     }
-
 }



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