You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2003/04/15 02:14:28 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionMessages.java
dgraham 2003/04/14 17:14:28
Modified: src/share/org/apache/struts/action ActionMessages.java
Log:
Allow messages object passed to add(ActionMessages) to be null for
PR# 18991.
Revision Changes Path
1.9 +15 -10 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ActionMessages.java 7 Jan 2003 06:32:25 -0000 1.8
+++ ActionMessages.java 15 Apr 2003 00:14:28 -0000 1.9
@@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -129,6 +129,7 @@
* messages.
*
* @param messages The messages to be initially added to this object.
+ * This parameter can be <code>null</code>.
* @since Struts 1.1
*/
public ActionMessages(ActionMessages messages) {
@@ -170,10 +171,14 @@
* 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.
+ * @param messages The <code>ActionMessages</code> object to be added.
+ * This parameter can be <code>null</code>.
* @since Struts 1.1
*/
public void add(ActionMessages messages) {
+ if (messages == null) {
+ return;
+ }
// loop over properties
Iterator props = messages.properties();
while (props.hasNext()) {
@@ -185,7 +190,6 @@
ActionMessage msg = (ActionMessage) msgs.next();
this.add(property, msg);
}
-
}
}
@@ -223,7 +227,7 @@
*/
public Iterator get() {
- if (messages.size() == 0) {
+ if (messages.isEmpty()) {
return (Collections.EMPTY_LIST.iterator());
}
@@ -313,10 +317,11 @@
ActionMessageItem ami = (ActionMessageItem) messages.get(property);
- if (ami == null)
+ if (ami == null) {
return (0);
- else
+ } else {
return (ami.getList().size());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org