Summary: | NPE in tagPlugins:ForEach | ||
---|---|---|---|
Product: | Tomcat 7 | Reporter: | Sheldon Shao <xshao> |
Component: | Jasper | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | trunk | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Bug Depends on: | |||
Bug Blocks: | 54314 | ||
Attachments: |
Patch for ForEach
New patch, upgraded based on Konstantin's suggestion Test case for "ForEach" Helper class for testing purpose Helper class for testing purpose |
The JSTL spec does indeed require that null is treated like an empty collection. The patch does not include a test case. I think generating an "if(itemsV != null){ }" clause around the whole iteration loop will be more effective. An iterator is a temporary object that is GC'ed. Created attachment 29709 [details]
New patch, upgraded based on Konstantin's suggestion
Created attachment 29710 [details]
Test case for "ForEach"
Created attachment 29711 [details]
Helper class for testing purpose
Test case has been included. Thanks (In reply to comment #1) > The JSTL spec does indeed require that null is treated like an empty > collection. > > The patch does not include a test case. Created attachment 29772 [details]
Helper class for testing purpose
Thanks for the report and the patches. I have applied the updated patch to fix the issue to trunk and 7.0.x. It will be included in 7.0.35 onwards. I used a different test case based on the existing test cases for the JSTL tag plug-ins. Those test cases only work on Tomcat 8 because they depend on the new resources implementation but my preference for test cases like these is - where possible - to use a real web application. |
Created attachment 29689 [details] Patch for ForEach There is not NULL pointer handling for iterator in ForEach. If the iterator is NULL, there is a NPE.