[
https://issues.jboss.org/browse/RF-10945?page=com.atlassian.jira.plugin.s...
]
Lutz Ulrich commented on RF-10945:
----------------------------------
To me it seems, this bug has been implicitly fixed in RichFaces 4.3.0.Final .
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: 5-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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira