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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.6.0
    • Fix Version/s: 6.7.0
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: