]
Nick Belaevski updated RF-10945:
--------------------------------
Fix Version/s: 4.Future
TabPanel without any Tab: NullPointerException in
AbstractTabPanel.getActiveItem()
----------------------------------------------------------------------------------
Key: RF-10945
URL:
https://issues.jboss.org/browse/RF-10945
Project: RichFaces
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: component-panels-layout-themes
Affects Versions: 4.0.0.Final
Reporter: Lutz Ulrich
Fix For: 4.Future
Hello,
when removing the last UITab child from UITabPanel (via AJAX request) a
NullPointerException is thrown by AbstractTabPanel.getActiveItem() when re-rending the
UITabPanel:
getFirstItem().getName() => cannot work since getFirstItem() returns null
There should be no errors when the UITabPanel is empty.
I fixed that in my local 'copy' of AbstractTabPanel by checking if getFirstItem()
returns null. If it is null, getActiveItem() returns null, too.
Seems to work for me. But I didn't do much testing on that, yet.
public String getActiveItem() {
String res = super.getActiveItem();
if (res == null) {
// L. Ulrich, 21.04.2011
// original code
//res = getFirstItem().getName();
// fixed code:
AbstractTogglePanelItemInterface firstItem = getFirstItem();
if (firstItem != null)
{
res = firstItem.getName();
}
// end of fixed code
} else {
AbstractTogglePanelTitledItem item =
(AbstractTogglePanelTitledItem)
super.getItemByIndex(super.getChildIndex(res));
if (item.isDisabled()) {
res = getFirstItem().getName();
}
}
return res;
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: