You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ma...@apache.org on 2003/01/07 07:32:26 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionErrors.java ActionFormBeans.java ActionForwards.java ActionMappings.java ActionMessages.java ExceptionHandler.java ForwardingActionForward.java RedirectingActionForward.java RequestActionMapping.java SessionActionMapping.java
martinc 2003/01/06 22:32:26
Modified: src/share/org/apache/struts/action ActionErrors.java
ActionFormBeans.java ActionForwards.java
ActionMappings.java ActionMessages.java
ExceptionHandler.java ForwardingActionForward.java
RedirectingActionForward.java
RequestActionMapping.java SessionActionMapping.java
Log:
Detab sources.
Revision Changes Path
1.10 +40 -40 jakarta-struts/src/share/org/apache/struts/action/ActionErrors.java
Index: ActionErrors.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionErrors.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ActionErrors.java 20 Oct 2002 19:10:45 -0000 1.9
+++ ActionErrors.java 7 Jan 2003 06:32:25 -0000 1.10
@@ -88,44 +88,44 @@
public class ActionErrors extends ActionMessages implements Serializable {
- // ----------------------------------------------------- Manifest Constants
+ // ----------------------------------------------------- Manifest Constants
- /**
- * The "property name" marker to use for global errors, as opposed to
- * those related to a specific property.
- */
- public static final String GLOBAL_ERROR = "org.apache.struts.action.GLOBAL_ERROR";
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Create an empty <code>ActionErrors</code> object.
- */
- public ActionErrors() {
- super();
- }
-
- /**
- * Create an <code>ActionErrors</code> object initialized with the given
- * messages.
- *
- * @param messages The messages to be initially added to this object.
- * @since Struts 1.1
- */
- public ActionErrors(ActionErrors messages) {
- super(messages);
- }
-
- /**
- * Add an error message to the set of errors for the specified property.
- *
- * @param property Property name (or ActionErrors.GLOBAL_ERROR)
- * @param error The error message to be added
- */
- public void add(String property, ActionError error) {
+ /**
+ * The "property name" marker to use for global errors, as opposed to
+ * those related to a specific property.
+ */
+ public static final String GLOBAL_ERROR = "org.apache.struts.action.GLOBAL_ERROR";
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Create an empty <code>ActionErrors</code> object.
+ */
+ public ActionErrors() {
+ super();
+ }
+
+ /**
+ * Create an <code>ActionErrors</code> object initialized with the given
+ * messages.
+ *
+ * @param messages The messages to be initially added to this object.
+ * @since Struts 1.1
+ */
+ public ActionErrors(ActionErrors messages) {
+ super(messages);
+ }
+
+ /**
+ * Add an error message to the set of errors for the specified property.
+ *
+ * @param property Property name (or ActionErrors.GLOBAL_ERROR)
+ * @param error The error message to be added
+ */
+ public void add(String property, ActionError error) {
- super.add(property, error);
+ super.add(property, error);
- }
+ }
}
1.7 +7 -7 jakarta-struts/src/share/org/apache/struts/action/ActionFormBeans.java
Index: ActionFormBeans.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionFormBeans.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ActionFormBeans.java 28 Nov 2002 07:12:42 -0000 1.6
+++ ActionFormBeans.java 7 Jan 2003 06:32:25 -0000 1.7
@@ -125,7 +125,7 @@
*/
public void addFormBean(ActionFormBean formBean) {
- formBeans.put(formBean.getName(), formBean);
+ formBeans.put(formBean.getName(), formBean);
}
@@ -138,7 +138,7 @@
*/
public ActionFormBean findFormBean(String name) {
- return ((ActionFormBean) formBeans.get(name));
+ return ((ActionFormBean) formBeans.get(name));
}
@@ -162,7 +162,7 @@
*/
public void removeFormBean(ActionFormBean formBean) {
- formBeans.remove(formBean.getName());
+ formBeans.remove(formBean.getName());
}
1.8 +7 -7 jakarta-struts/src/share/org/apache/struts/action/ActionForwards.java
Index: ActionForwards.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionForwards.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ActionForwards.java 28 Nov 2002 07:12:42 -0000 1.7
+++ ActionForwards.java 7 Jan 2003 06:32:25 -0000 1.8
@@ -125,7 +125,7 @@
*/
public void addForward(ActionForward forward) {
- forwards.put(forward.getName(), forward);
+ forwards.put(forward.getName(), forward);
}
@@ -138,7 +138,7 @@
*/
public ActionForward findForward(String name) {
- return ((ActionForward) forwards.get(name));
+ return ((ActionForward) forwards.get(name));
}
@@ -162,7 +162,7 @@
*/
public void removeForward(ActionForward forward) {
- forwards.remove(forward.getName());
+ forwards.remove(forward.getName());
}
1.11 +7 -7 jakarta-struts/src/share/org/apache/struts/action/ActionMappings.java
Index: ActionMappings.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionMappings.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ActionMappings.java 28 Nov 2002 07:12:42 -0000 1.10
+++ ActionMappings.java 7 Jan 2003 06:32:25 -0000 1.11
@@ -201,7 +201,7 @@
*/
public void addMapping(ActionMapping mapping) {
- mappings.put(mapping.getPath(), mapping);
+ mappings.put(mapping.getPath(), mapping);
// mapping.setMappings(this);
}
@@ -215,7 +215,7 @@
*/
public ActionMapping findMapping(String path) {
- return ((ActionMapping) mappings.get(path));
+ return ((ActionMapping) mappings.get(path));
}
@@ -239,7 +239,7 @@
*/
public void removeMapping(ActionMapping mapping) {
- mappings.remove(mapping.getPath());
+ mappings.remove(mapping.getPath());
// mapping.setMappings(null);
}
1.8 +267 -267 jakarta-struts/src/share/org/apache/struts/action/ActionMessages.java
Index: ActionMessages.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionMessages.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ActionMessages.java 20 Oct 2002 19:11:15 -0000 1.7
+++ ActionMessages.java 7 Jan 2003 06:32:25 -0000 1.8
@@ -93,270 +93,270 @@
public class ActionMessages implements Serializable {
- // ----------------------------------------------------- Manifest Constants
+ // ----------------------------------------------------- Manifest Constants
- /**
- * The "property name" marker to use for global messages, as opposed to
- * those related to a specific property.
- */
- public static final String GLOBAL_MESSAGE = "org.apache.struts.action.GLOBAL_MESSAGE";
-
- // ----------------------------------------------------- Instance Variables
-
- /**
- * The accumulated set of <code>ActionMessage</code> objects (represented
- * as an ArrayList) for each property, keyed by property name.
- */
- protected HashMap messages = new HashMap();
-
- /**
- * The current number of the property/key being added. This is used
- * to maintain the order messages are added.
- */
- protected int iCount = 0;
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Create an empty <code>ActionMessages</code> object.
- */
- public ActionMessages() {
- super();
- }
-
- /**
- * Create an <code>ActionMessages</code> object initialized with the given
- * messages.
- *
- * @param messages The messages to be initially added to this object.
- * @since Struts 1.1
- */
- public ActionMessages(ActionMessages messages) {
- super();
- this.add(messages);
- }
-
- /**
- * Add a message to the set of messages for the specified property. An
- * order of the property/key is maintained based on the initial addition
- * of the property/key.
- *
- * @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
- * @param message The message to be added
- */
- public void add(String property, ActionMessage message) {
-
- ActionMessageItem item = (ActionMessageItem) messages.get(property);
- List list = null;
-
- if (item == null) {
- list = new ArrayList();
- item = new ActionMessageItem(list, iCount++);
-
- messages.put(property, item);
- } else {
- list = item.getList();
- }
-
- list.add(message);
-
- }
-
- /**
- * Adds the messages from the given <code>ActionMessages</code> object to
- * this set of messages. The messages are added in the order they are returned from
- * the properties() method. If a message's property is already in the current
- * <code>ActionMessages</code> object it is added to the end of the list for that
- * property. If a message's property is not in the current list it is added to the end
- * of the properties.
- *
- * @param messages The <code>ActionMessages</code> object to be added.
- * @since Struts 1.1
- */
- public void add(ActionMessages messages) {
- // loop over properties
- Iterator props = messages.properties();
- while (props.hasNext()) {
- String property = (String) props.next();
-
- // loop over messages for each property
- Iterator msgs = messages.get(property);
- while (msgs.hasNext()) {
- ActionMessage msg = (ActionMessage) msgs.next();
- this.add(property, msg);
- }
-
- }
- }
-
- /**
- * Clear all messages recorded by this object.
- */
- public void clear() {
-
- messages.clear();
-
- }
-
- /**
- * Return <code>true</code> if there are no messages recorded
- * in this collection, or <code>false</code> otherwise.
- * @deprecated Use isEmpty instead.
- */
- public boolean empty() {
- return (this.isEmpty());
- }
-
- /**
- * Return <code>true</code> if there are no messages recorded
- * in this collection, or <code>false</code> otherwise.
- * @since Struts 1.1
- */
- public boolean isEmpty(){
- return (messages.isEmpty());
- }
-
- /**
- * Return the set of all recorded messages, without distinction
- * by which property the messages are associated with. If there are
- * no messages recorded, an empty enumeration is returned.
- */
- public Iterator get() {
-
- if (messages.size() == 0) {
- return (Collections.EMPTY_LIST.iterator());
- }
-
- ArrayList results = new ArrayList();
- ArrayList actionItems = new ArrayList();
-
- for (Iterator i = messages.values().iterator(); i.hasNext();) {
- actionItems.add(i.next());
- }
-
- // Sort ActionMessageItems based on the initial order the
- // property/key was added to ActionMessages.
- Collections.sort(actionItems, new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((ActionMessageItem) o1).getOrder() - ((ActionMessageItem) o2).getOrder();
- }
- });
-
- for (Iterator i = actionItems.iterator(); i.hasNext();) {
- ActionMessageItem ami = (ActionMessageItem) i.next();
-
- for (Iterator messages = ami.getList().iterator(); messages.hasNext();) {
- results.add(messages.next());
- }
- }
-
- return (results.iterator());
-
- }
-
- /**
- * Return the set of messages related to a specific property.
- * If there are no such messages, an empty enumeration is returned.
- *
- * @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
- */
- public Iterator get(String property) {
-
- ActionMessageItem item = (ActionMessageItem) messages.get(property);
-
- if (item == null) {
- return (Collections.EMPTY_LIST.iterator());
- } else {
- return (item.getList().iterator());
- }
-
- }
-
- /**
- * Return the set of property names for which at least one message has
- * been recorded. If there are no messages, an empty Iterator is returned.
- * If you have recorded global messages, the String value of
- * <code>ActionMessages.GLOBAL_MESSAGE</code> will be one of the returned
- * property names.
- */
- public Iterator properties() {
-
- return (messages.keySet().iterator());
-
- }
-
- /**
- * Return the number of messages recorded for all properties (including
- * global messages). <strong>NOTE</strong> - it is more efficient to call
- * <code>empty()</code> if all you care about is whether or not there are
- * any messages at all.
- */
- public int size() {
-
- int total = 0;
-
- for (Iterator i = messages.values().iterator(); i.hasNext();) {
- ActionMessageItem ami = (ActionMessageItem) i.next();
- total += ami.getList().size();
- }
-
- return (total);
-
- }
-
- /**
- * Return the number of messages associated with the specified property.
- *
- * @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
- */
- public int size(String property) {
-
- ActionMessageItem ami = (ActionMessageItem) messages.get(property);
-
- if (ami == null)
- return (0);
- else
- return (ami.getList().size());
-
- }
-
- /**
- * This class is used to store a set of messages associated with a
- * property/key and the position it was initially added to list.
- */
- protected class ActionMessageItem implements Serializable {
-
- /**
- * The list of <code>ActionMessage</code>s.
- */
- protected List list = null;
-
- /**
- * The position in the list of messages.
- */
- protected int iOrder = 0;
-
- public ActionMessageItem(List list, int iOrder) {
- this.list = list;
- this.iOrder = iOrder;
- }
-
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
- public int getOrder() {
- return iOrder;
- }
-
- public void setOrder(int iOrder) {
- this.iOrder = iOrder;
- }
+ /**
+ * The "property name" marker to use for global messages, as opposed to
+ * those related to a specific property.
+ */
+ public static final String GLOBAL_MESSAGE = "org.apache.struts.action.GLOBAL_MESSAGE";
+
+ // ----------------------------------------------------- Instance Variables
+
+ /**
+ * The accumulated set of <code>ActionMessage</code> objects (represented
+ * as an ArrayList) for each property, keyed by property name.
+ */
+ protected HashMap messages = new HashMap();
+
+ /**
+ * The current number of the property/key being added. This is used
+ * to maintain the order messages are added.
+ */
+ protected int iCount = 0;
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Create an empty <code>ActionMessages</code> object.
+ */
+ public ActionMessages() {
+ super();
+ }
+
+ /**
+ * Create an <code>ActionMessages</code> object initialized with the given
+ * messages.
+ *
+ * @param messages The messages to be initially added to this object.
+ * @since Struts 1.1
+ */
+ public ActionMessages(ActionMessages messages) {
+ super();
+ this.add(messages);
+ }
+
+ /**
+ * Add a message to the set of messages for the specified property. An
+ * order of the property/key is maintained based on the initial addition
+ * of the property/key.
+ *
+ * @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
+ * @param message The message to be added
+ */
+ public void add(String property, ActionMessage message) {
+
+ ActionMessageItem item = (ActionMessageItem) messages.get(property);
+ List list = null;
+
+ if (item == null) {
+ list = new ArrayList();
+ item = new ActionMessageItem(list, iCount++);
+
+ messages.put(property, item);
+ } else {
+ list = item.getList();
+ }
+
+ list.add(message);
+
+ }
+
+ /**
+ * Adds the messages from the given <code>ActionMessages</code> object to
+ * this set of messages. The messages are added in the order they are returned from
+ * the properties() method. If a message's property is already in the current
+ * <code>ActionMessages</code> object it is added to the end of the list for that
+ * property. If a message's property is not in the current list it is added to the end
+ * of the properties.
+ *
+ * @param messages The <code>ActionMessages</code> object to be added.
+ * @since Struts 1.1
+ */
+ public void add(ActionMessages messages) {
+ // loop over properties
+ Iterator props = messages.properties();
+ while (props.hasNext()) {
+ String property = (String) props.next();
+
+ // loop over messages for each property
+ Iterator msgs = messages.get(property);
+ while (msgs.hasNext()) {
+ ActionMessage msg = (ActionMessage) msgs.next();
+ this.add(property, msg);
+ }
+
+ }
+ }
+
+ /**
+ * Clear all messages recorded by this object.
+ */
+ public void clear() {
+
+ messages.clear();
+
+ }
+
+ /**
+ * Return <code>true</code> if there are no messages recorded
+ * in this collection, or <code>false</code> otherwise.
+ * @deprecated Use isEmpty instead.
+ */
+ public boolean empty() {
+ return (this.isEmpty());
+ }
+
+ /**
+ * Return <code>true</code> if there are no messages recorded
+ * in this collection, or <code>false</code> otherwise.
+ * @since Struts 1.1
+ */
+ public boolean isEmpty(){
+ return (messages.isEmpty());
+ }
+
+ /**
+ * Return the set of all recorded messages, without distinction
+ * by which property the messages are associated with. If there are
+ * no messages recorded, an empty enumeration is returned.
+ */
+ public Iterator get() {
+
+ if (messages.size() == 0) {
+ return (Collections.EMPTY_LIST.iterator());
+ }
+
+ ArrayList results = new ArrayList();
+ ArrayList actionItems = new ArrayList();
+
+ for (Iterator i = messages.values().iterator(); i.hasNext();) {
+ actionItems.add(i.next());
+ }
+
+ // Sort ActionMessageItems based on the initial order the
+ // property/key was added to ActionMessages.
+ Collections.sort(actionItems, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return ((ActionMessageItem) o1).getOrder() - ((ActionMessageItem) o2).getOrder();
+ }
+ });
+
+ for (Iterator i = actionItems.iterator(); i.hasNext();) {
+ ActionMessageItem ami = (ActionMessageItem) i.next();
+
+ for (Iterator messages = ami.getList().iterator(); messages.hasNext();) {
+ results.add(messages.next());
+ }
+ }
+
+ return (results.iterator());
+
+ }
+
+ /**
+ * Return the set of messages related to a specific property.
+ * If there are no such messages, an empty enumeration is returned.
+ *
+ * @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
+ */
+ public Iterator get(String property) {
+
+ ActionMessageItem item = (ActionMessageItem) messages.get(property);
+
+ if (item == null) {
+ return (Collections.EMPTY_LIST.iterator());
+ } else {
+ return (item.getList().iterator());
+ }
+
+ }
+
+ /**
+ * Return the set of property names for which at least one message has
+ * been recorded. If there are no messages, an empty Iterator is returned.
+ * If you have recorded global messages, the String value of
+ * <code>ActionMessages.GLOBAL_MESSAGE</code> will be one of the returned
+ * property names.
+ */
+ public Iterator properties() {
+
+ return (messages.keySet().iterator());
+
+ }
+
+ /**
+ * Return the number of messages recorded for all properties (including
+ * global messages). <strong>NOTE</strong> - it is more efficient to call
+ * <code>empty()</code> if all you care about is whether or not there are
+ * any messages at all.
+ */
+ public int size() {
+
+ int total = 0;
+
+ for (Iterator i = messages.values().iterator(); i.hasNext();) {
+ ActionMessageItem ami = (ActionMessageItem) i.next();
+ total += ami.getList().size();
+ }
+
+ return (total);
+
+ }
+
+ /**
+ * Return the number of messages associated with the specified property.
+ *
+ * @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
+ */
+ public int size(String property) {
+
+ ActionMessageItem ami = (ActionMessageItem) messages.get(property);
+
+ if (ami == null)
+ return (0);
+ else
+ return (ami.getList().size());
+
+ }
+
+ /**
+ * This class is used to store a set of messages associated with a
+ * property/key and the position it was initially added to list.
+ */
+ protected class ActionMessageItem implements Serializable {
+
+ /**
+ * The list of <code>ActionMessage</code>s.
+ */
+ protected List list = null;
+
+ /**
+ * The position in the list of messages.
+ */
+ protected int iOrder = 0;
+
+ public ActionMessageItem(List list, int iOrder) {
+ this.list = list;
+ this.iOrder = iOrder;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ public int getOrder() {
+ return iOrder;
+ }
+
+ public void setOrder(int iOrder) {
+ this.iOrder = iOrder;
+ }
- }
+ }
}
1.15 +1 -1 jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java
Index: ExceptionHandler.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ExceptionHandler.java 25 Dec 2002 09:01:46 -0000 1.14
+++ ExceptionHandler.java 7 Jan 2003 06:32:25 -0000 1.15
@@ -103,7 +103,7 @@
forward = new ActionForward(ae.getPath());
forward.setContextRelative(true);
} else {
- forward = mapping.getInputForward();
+ forward = mapping.getInputForward();
}
// Figure out the error
1.3 +9 -9 jakarta-struts/src/share/org/apache/struts/action/ForwardingActionForward.java
Index: ForwardingActionForward.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ForwardingActionForward.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ForwardingActionForward.java 21 Feb 2001 00:35:46 -0000 1.2
+++ ForwardingActionForward.java 7 Jan 2003 06:32:25 -0000 1.3
@@ -82,7 +82,7 @@
*/
public ForwardingActionForward() {
- this(null);
+ this(null);
}
@@ -94,10 +94,10 @@
*/
public ForwardingActionForward(String path) {
- super();
- setName(null);
- setPath(path);
- setRedirect(false);
+ super();
+ setName(null);
+ setPath(path);
+ setRedirect(false);
}
1.3 +9 -9 jakarta-struts/src/share/org/apache/struts/action/RedirectingActionForward.java
Index: RedirectingActionForward.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/RedirectingActionForward.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RedirectingActionForward.java 21 Feb 2001 00:35:46 -0000 1.2
+++ RedirectingActionForward.java 7 Jan 2003 06:32:25 -0000 1.3
@@ -82,7 +82,7 @@
*/
public RedirectingActionForward() {
- this(null);
+ this(null);
}
@@ -94,10 +94,10 @@
*/
public RedirectingActionForward(String path) {
- super();
- setName(null);
- setPath(path);
- setRedirect(true);
+ super();
+ setName(null);
+ setPath(path);
+ setRedirect(true);
}
1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/action/RequestActionMapping.java
Index: RequestActionMapping.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/RequestActionMapping.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RequestActionMapping.java 21 Feb 2001 00:35:46 -0000 1.3
+++ RequestActionMapping.java 7 Jan 2003 06:32:25 -0000 1.4
@@ -80,8 +80,8 @@
*/
public RequestActionMapping() {
- super();
- setScope("request");
+ super();
+ setScope("request");
}
1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/action/SessionActionMapping.java
Index: SessionActionMapping.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/SessionActionMapping.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionActionMapping.java 21 Feb 2001 00:35:46 -0000 1.3
+++ SessionActionMapping.java 7 Jan 2003 06:32:25 -0000 1.4
@@ -80,8 +80,8 @@
*/
public SessionActionMapping() {
- super();
- setScope("session");
+ super();
+ setScope("session");
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>