Bug 49534 - ForEachSupport handles unsupported items inconsistently
Summary: ForEachSupport handles unsupported items inconsistently
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.2.0
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2010-07-01 01:01 UTC by Jeremy Boynes
Modified: 2010-07-01 02:16 UTC (History)
0 users

Patch to throw exception on invalid items in deferred expression (1.58 KB, patch)
2010-07-01 01:04 UTC, Jeremy Boynes
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.