Bug 49534

Summary: ForEachSupport handles unsupported items inconsistently
Product: Taglibs Reporter: Jeremy Boynes <jboynes>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 1.2.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Patch to throw exception on invalid items in deferred expression

Description Jeremy Boynes 2010-07-01 01:01:59 UTC
When the "items" attribute contains an unsupported type an exception is thrown with a "FOREACH_BAD_ITEMS" error message. However, if it contains a value expression that evaluates to an unsupported type, no error occurs. An example would be the snippet:

  <c:set var="hello" value="${true}"/>
  <c:forEach var="x" items="#{hello}">
      <c:out value="${x}"/>
Comment 1 Jeremy Boynes 2010-07-01 01:04:26 UTC
Created attachment 25674 [details]
Patch to throw exception on invalid items in deferred expression

This patch also removes commented out code that would have bound an deferred expression to the loop variable; this function is performed in LoopTagSupport and is not needed
Comment 2 Henri Yandell 2010-07-01 02:16:30 UTC
Looks great - thanks :)

svn ci -m "Adding an exception when the type is not recognized in determineLengthAndType; and removing some unused variables/commented out lines in the prepare method. Thanks to Jeremy Boynes' patch to #49534"
Sending        impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java
Transmitting file data .
Committed revision 959527.