Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5116

TabbedPanel.setSelectedTab() does not behave as specified in JavaDoc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.6.0
    • 6.7.0
    • None
    • None

    Description

      The JavaDoc of TabbedPanel.setSelectedTab() states that -1 is a valid argument. Actually passing -1 will throw a IndexOutOfBoundsException

      	/**
      	 * sets the selected tab
      	 * 
      	 * @param index
      	 *            index of the tab to select
      	 * @return this for chaining
      	 * @throws IndexOutOfBoundsException
      	 *             if index is not {@code -1} or in the range of available tabs
      	 */
      	public TabbedPanel<T> setSelectedTab(final int index)
      	{
      		if ((index < 0) || (index >= tabs.size()))
      		{
      			throw new IndexOutOfBoundsException();
      		}
      
      		setDefaultModelObject(index);
      
      		// force the tab's component to be aquired again if already the current tab
      		currentTab = -1;
      		setCurrentTab(index);
      
      		return this;
      	}
      

      Attachments

        Activity

          People

            svenmeier Sven Meier
            sclassen Stephan Classen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: