[richfaces-issues] [JBoss JIRA] Updated: (RF-10945) TabPanel without any Tab: NullPointerException in AbstractTabPanel.getActiveItem()

SBS JIRA Integration (JIRA) jira-events at lists.jboss.org
Fri Jun 10 07:04:59 EDT 2011


     [ https://issues.jboss.org/browse/RF-10945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

SBS JIRA Integration updated RF-10945:
--------------------------------------

    JBoss Forum Reference: http://community.jboss.org/message/602791#602791


> 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: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list