You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thies Edeling <th...@rrm.net> on 2009/12/01 14:14:51 UTC

TabbedPanel, tabsVisibilityCache throws IndexOutOfBounds

With wicket extensions 1.4.3, TabbedPanel throws an IndexOutOfBounds 
exception on the tabsVisibilityCache array when adding more tabs after 
the panel is rendered.

The onBeforeRender method calls the isTabVisible method which 
initializes an array of booleans for visibility caching. The length of 
this array is the amount of tabs added at that time. When - through ajax 
- a new tab is added after rendering and setSelectedTab is called an 
exception is thrown at:
    Boolean visible = tabsVisibilityCache[tabIndex];

Fix: increase the array before checking or use a List:
        if (tabsVisibilityCache.length < tabIndex + 1)
        {
            tabsVisibilityCache = Arrays.copyOf(tabsVisibilityCache, 
tabIndex + 1);       
        }

Shall I create a jira issue for this?

--Thies

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: TabbedPanel, tabsVisibilityCache throws IndexOutOfBounds

Posted by Thies Edeling <th...@rrm.net>.
ok, https://issues.apache.org/jira/browse/WICKET-2594 created

Igor Vaynberg wrote:
> yep, with a testcase
>
> -igor
>
> On Tue, Dec 1, 2009 at 5:14 AM, Thies Edeling <th...@rrm.net> wrote:
>   
>> With wicket extensions 1.4.3, TabbedPanel throws an IndexOutOfBounds
>> exception on the tabsVisibilityCache array when adding more tabs after the
>> panel is rendered.
>>
>> The onBeforeRender method calls the isTabVisible method which initializes an
>> array of booleans for visibility caching. The length of this array is the
>> amount of tabs added at that time. When - through ajax - a new tab is added
>> after rendering and setSelectedTab is called an exception is thrown at:
>>   Boolean visible = tabsVisibilityCache[tabIndex];
>>
>> Fix: increase the array before checking or use a List:
>>       if (tabsVisibilityCache.length < tabIndex + 1)
>>       {
>>           tabsVisibilityCache = Arrays.copyOf(tabsVisibilityCache, tabIndex
>> + 1);             }
>>
>> Shall I create a jira issue for this?
>>
>> --Thies
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: TabbedPanel, tabsVisibilityCache throws IndexOutOfBounds

Posted by Igor Vaynberg <ig...@gmail.com>.
yep, with a testcase

-igor

On Tue, Dec 1, 2009 at 5:14 AM, Thies Edeling <th...@rrm.net> wrote:
> With wicket extensions 1.4.3, TabbedPanel throws an IndexOutOfBounds
> exception on the tabsVisibilityCache array when adding more tabs after the
> panel is rendered.
>
> The onBeforeRender method calls the isTabVisible method which initializes an
> array of booleans for visibility caching. The length of this array is the
> amount of tabs added at that time. When - through ajax - a new tab is added
> after rendering and setSelectedTab is called an exception is thrown at:
>   Boolean visible = tabsVisibilityCache[tabIndex];
>
> Fix: increase the array before checking or use a List:
>       if (tabsVisibilityCache.length < tabIndex + 1)
>       {
>           tabsVisibilityCache = Arrays.copyOf(tabsVisibilityCache, tabIndex
> + 1);             }
>
> Shall I create a jira issue for this?
>
> --Thies
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org