History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1413
Type: Bug Bug
Status: Resolved Resolved
Resolution: Not A Problem
Priority: Major Major
Assignee: Unassigned
Reporter: Timothy Wonil Lee
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
WebWork

Numerical String as KeyProperty in Collection Type Conversion causes NPE (and sometimes ognl Exception).

Created: 08/Jan/07 05:06 PM   Updated: 04/Feb/07 03:54 PM
Component/s: None
Affects Version/s: 2.2.4
Fix Version/s: 2.2.5

File Attachments: 1. Java Source File Item.java (0.9 kb)
2. File itemList.jsp (0.4 kb)
3. File itemListForm.jsp (0.6 kb)
4. Java Source File MakeItemList.java (1 kb)
5. File UpdateItemList-conversion.properties (0.1 kb)
6. Java Source File UpdateItemList.java (0.8 kb)
7. File webwork.properties (0.7 kb)
8. XML File xwork.xml (0.7 kb)

Environment:
Tomcat 5.5.20 (running on Java 1.5)
WebWork 2.2.4
Spring 2.0


 Description  « Hide
When String was used as KeyProperty in Collection Type Conversion, some values of the KeyProperty caused NPE and sometimes ognl.ExpressionSyntaxException as well.

Some values of KeyProperty that was proven to cause Exceptions are: "08", "09", "a8", "a9", "a5"

Discussions on this issue and examples of Exceptions produced can be found at http://forums.opensymphony.com/thread.jspa?threadID=50841&tstart=0

Code to reproduce this behaviour is attached.



 All   Comments   Change History      Sort Order:
Timothy Wonil Lee - [08/Jan/07 05:16 PM ]
If anyone would like to see more example code, I can upload more. Just let me know by leaving a comment. Thanks!

Tom Schneider - [04/Feb/07 10:51 AM ]
The ognl expressions that you are generating are invalid. The ognl expression that was failing compilation was:

itemList(09).desc

I don't think itemList(03).desc is truly valid either, but it doesn't fail compilation. The way to fix this is to add the single quotes needed so ognl treats the 09 as a string:

itemList('09').desc

so the jsp would look like this (itemListForm.jsp):
        <ww:textfield label="%{#status.index} - Item Id" name="itemList('%{id}').id" value="%{id}"/>
        <ww:textfield label="Item Desc" name="itemList('%{id}').desc" value="%{desc}"/>

This made the test code work.

Timothy Wonil Lee - [04/Feb/07 03:54 PM ]
Wow! So that was the problem! Thank you Tom!