last not working with 3.0 release

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

last not working with 3.0 release

rogergl
The following code worked in 2.1.x but gives a null pointer  exception with the current 3.0 release when calling iterationStatus.last.

 
       
       
   

Reply | Threaded
Open this post in threaded view
|

Re: last not working with 3.0 release

rogergl
The code is:
  
<span th:each="hitem,iterationStatus:${historyItems}">
        <a th:if="${!iterationStatus.last}" 
             th:text="${hitem.title}"></a>
        <span th:if="${iterationStatus.last}" th:text="${hitem.title}"></span>
</span>

Reply | Threaded
Open this post in threaded view
|

Re: last not working with 3.0 release

danielfernandez
Administrator
I am unable to reproduce this. Actually, I've just added this test https://github.com/thymeleaf/thymeleaf-tests/blob/3.0-spring42/src/test/resources/templateengine/features/expression/expression61.thtest which sets a scenario very similar to your code, and passes perfectly fine.

Could you please make sure your NullPointerException is actually in "iterationStatus.last" and not in anything related to the "hitem" variable