Details
-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
1.0 RC3, 1.0 RC4
-
None
-
Oracle10g database
-
makeList, null
-
Low
-
Description
In the following class and method.... core/src/main/java/com.xpn.xwiki.objects.classes.DBListClass.makeList(List list)
if list contains a null result for what ever reason, it throws a NullPointer if a result variable is null, then the list it's trying to make no longer contains all of the other non-null values. An example of when this happended was when using the Blog piece and adding categories with no name. When the makeList(List) method is called, it blows up. The following is a work around.... ---> indicates an added line....
public List makeList(List list) { List list2 = new ArrayList(); for (int i=0;i<list.size();i++) { Object result = list.get(i); ---> if(result != null){ if (result instanceof String) { list2.add(new ListItem((String) result)); } else { Object[] res = (Object[]) result; if (res.length==1) list2.add(new ListItem(res[0].toString())); else if (res.length==2) list2.add(new ListItem(res[0].toString(), res[1].toString())); else list2.add(new ListItem(res[0].toString(), res[1].toString(), res[2].toString())); } ---> } } return list2; }
Attachments
Issue Links
- duplicates
-
XWIKI-2012 NPE when editing a blog post when database is Oracle
- Closed