Details
-
Type: Bug
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 1.5.2
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Operating System: Windows XP
Platform: PC
Description
a client ran into the following NPE:
Caused by: java.lang.NullPointerException
at
com.icesoft.faces.component.selectinputtext.SelectInputText.populateItemList(SelectInputText.java:239)
at
com.icesoft.faces.component.selectinputtext.SelectInputText.broadcast(SelectInputText.java:255)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:269)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:363)
at
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:98)
... 32 more
They were using a session-scoped bean with concurrentDOMViews and setting the
list temporarily to null. We should check for null like so:
void populateItemList() {
if (getSelectFacet() != null) {
//facet being used on jsf page, so get the list from the value binding
itemList = getListValue();
} else {
//selectItem or selectItems has been used on jsf page, so get the
selectItems
itemList = Util.getSelectItems(FacesContext.getCurrentInstance(),
this);
}
if( itemList != null ){
Iterator items = itemList.iterator();
SelectItem item = null;
itemMap.clear();
while (items.hasNext()) {
item = (SelectItem) items.next();
itemMap.put(item.getLabel(), item);
}
}
}
Caused by: java.lang.NullPointerException
at
com.icesoft.faces.component.selectinputtext.SelectInputText.populateItemList(SelectInputText.java:239)
at
com.icesoft.faces.component.selectinputtext.SelectInputText.broadcast(SelectInputText.java:255)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:269)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:363)
at
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:98)
... 32 more
They were using a session-scoped bean with concurrentDOMViews and setting the
list temporarily to null. We should check for null like so:
void populateItemList() {
if (getSelectFacet() != null) {
//facet being used on jsf page, so get the list from the value binding
itemList = getListValue();
} else {
//selectItem or selectItems has been used on jsf page, so get the
selectItems
itemList = Util.getSelectItems(FacesContext.getCurrentInstance(),
this);
}
if( itemList != null ){
Iterator items = itemList.iterator();
SelectItem item = null;
itemMap.clear();
while (items.hasNext()) {
item = (SelectItem) items.next();
itemMap.put(item.getLabel(), item);
}
}
}
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
The NullPointerException has been caught, which let application to execute and developer to know about it.
Fixed have -r 13330