[
https://issues.apache.org/jira/browse/WICKET-2594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thies Edeling updated WICKET-2594:
----------------------------------
Description:
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. In TabbedPanel
private boolean isTabVisible(int tabIndex)
{
if (tabsVisibilityCache == null)
{
tabsVisibilityCache = new Boolean[getTabs().size()];
}
if (tabsVisibilityCache.length < tabIndex + 1)
{
tabsVisibilityCache =
Arrays.copyOf(tabsVisibilityCache, tabIndex + 1);
}
if (tabsVisibilityCache.length > 0)
{
Boolean visible = tabsVisibilityCache[tabIndex];
if (visible == null)
{
visible = getTabs().get(tabIndex).isVisible();
tabsVisibilityCache[tabIndex] = visible;
}
return visible;
}
else
{
return false;
}
}
was:
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);
}
> TabbedPanel, tabsVisibilityCache throws IndexOutOfBounds
> --------------------------------------------------------
>
> Key: WICKET-2594
> URL: https://issues.apache.org/jira/browse/WICKET-2594
> Project: Wicket
> Issue Type: Bug
> Components: wicket-extensions
> Affects Versions: 1.4.3
> Reporter: Thies Edeling
> Attachments: TabbedPanelTest.java
>
>
> 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. In TabbedPanel
> private boolean isTabVisible(int tabIndex)
> {
> if (tabsVisibilityCache == null)
> {
> tabsVisibilityCache = new Boolean[getTabs().size()];
> }
> if (tabsVisibilityCache.length < tabIndex + 1)
> {
> tabsVisibilityCache =
> Arrays.copyOf(tabsVisibilityCache, tabIndex + 1);
> }
>
> if (tabsVisibilityCache.length > 0)
> {
> Boolean visible = tabsVisibilityCache[tabIndex];
>
> if (visible == null)
> {
> visible = getTabs().get(tabIndex).isVisible();
> tabsVisibilityCache[tabIndex] = visible;
> }
>
> return visible;
> }
> else
> {
> return false;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.