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/07/14 01:28:03 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/logic EmptyTag.java

dgraham     2003/07/13 16:28:03

  Modified:    src/share/org/apache/struts/taglib/logic EmptyTag.java
  Log:
  Simplified logic.
  
  Revision  Changes    Path
  1.8       +26 -25    jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java
  
  Index: EmptyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EmptyTag.java	10 May 2003 18:06:40 -0000	1.7
  +++ EmptyTag.java	13 Jul 2003 23:28:03 -0000	1.8
  @@ -63,7 +63,9 @@
   
   import java.util.Collection;
   import java.util.Map;
  +
   import javax.servlet.jsp.JspException;
  +
   import org.apache.struts.util.RequestUtils;
   
   /**
  @@ -113,8 +115,6 @@
   			RequestUtils.saveException(pageContext, e);
   			throw e;
   		}
  -
  -		boolean empty = true;
           
   		Object value = null;
   		if (this.property == null) {
  @@ -123,27 +123,28 @@
   			value = RequestUtils.lookup(pageContext, name, property, scope);
   		}
           
  -		if (value != null) {
  -            
  -			if (value instanceof String) {
  -				String strValue = (String) value;
  -				empty = (strValue.length() < 1);
  -                
  -			} else if (value instanceof Collection) {
  -				Collection collValue = (Collection) value;
  -				empty = collValue.isEmpty();
  -                
  -			} else if (value instanceof Map) {
  -				Map mapValue = (Map) value;
  -				empty = mapValue.isEmpty();
  -                
  -			} else {
  -				empty = false;
  -			}
  -		}
  +        boolean empty = true;
  +        
  +        if (value == null) {
  +            empty = true;
  +
  +        } else if (value instanceof String) {
  +            String strValue = (String) value;
  +            empty = (strValue.length() < 1);
  +
  +        } else if (value instanceof Collection) {
  +            Collection collValue = (Collection) value;
  +            empty = collValue.isEmpty();
  +
  +        } else if (value instanceof Map) {
  +            Map mapValue = (Map) value;
  +            empty = mapValue.isEmpty();
  +
  +        } else {
  +            empty = false;
  +        }
   
   		return (empty == desired);
       }
  -
   
   }
  
  
  

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