[
https://issues.apache.org/jira/browse/WICKET-2545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg resolved WICKET-2545.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.5-M1
1.4.4
Assignee: Igor Vaynberg
> NullPointerException thrown from BaseWicketTester isComponent
> -------------------------------------------------------------
>
> Key: WICKET-2545
> URL: https://issues.apache.org/jira/browse/WICKET-2545
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.1
> Environment: N/A
> Reporter: Ed Breuer
> Assignee: Igor Vaynberg
> Priority: Trivial
> Fix For: 1.4.4, 1.5-M1
>
>
> If a component is not visible, then "getComponentFromLastRenderedPage" will
> return null (as opposed to failing if it is not present). In the check
> below, it seems like "Result.fail" is missing a "return" preceding it.
> Otherwise, the "component.getClass()" immediately following will generate an
> NullPointerException.
> public <C extends Component> Result isComponent(String path, Class<C>
> expectedComponentClass)
> {
> Component component = getComponentFromLastRenderedPage(path);
> if (component == null)
> {
> Result.fail("Component not found: " + path); // <--
> Should return here.
> }
> return isTrue("component '" +
> Classes.simpleName(component.getClass()) + "' is not type:" + // <-- NPE
> thrown here
> Classes.simpleName(expectedComponentClass),
>
> expectedComponentClass.isAssignableFrom(component.getClass()));
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.