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
Priority: Trivial
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.