Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000121 [Resin] minor always 04-25-05 00:00 05-11-05 00:00
Reporter sam View Status public  
Assigned To
Priority normal Resolution fixed  
Status closed   Product Version 3.0.12
Summary 0000121: c:forEach NoSuchElementException with len mod step != 0
Description RSN-112
(rep by T Palmer)

The problem I found is when using the JSTL tag c:forEach with items and
with step > 1 (where the number of items is not divisible by the step).
For instance, this (using indexes rather than items) works:

<c:forEach var="index" begin="0" end="${fn:length(someWords)}"
step="3">

This does not:

<c:forEach var="item" items="${someWords}" step="3">

At the end of the iteration (if it doesn't line up perfectly), you get a
NoSuchElementException. This is the compiled code that causes the problem:

for (int _jsp_si_3 = _jsp_step_3; _jsp_si_3 > 1; _jsp_si_3--)
  _jsp_iter_3.next();

There is no check for whether the next element exists. I think that the
behavior of this situation isn't incredibly explicit in the JSTL (1.1)
spec, but I would expect it to complete without an exception just as in
the case of the index looping mentioned earlier.

Additional Information
Attached Files

- Relationships

- Notes
(0000141)
ferg
04-25-05 00:00

jsp/1cm6
 

- Issue History
Date Modified Username Field Change
04-25-05 00:00 sam New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.13


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker