ResourceMapper doesn't work: mapHandler() always returns null
-------------------------------------------------------------
Key: WICKET-3506
URL: https://issues.apache.org/jira/browse/WICKET-3506
Project: Wicket
Issue Type: Bug
Components: wicket-core
Affects Versions: 1.5-RC2
Reporter: Matt Brictson
ResourceMapper#mapHandler uses the following code test whether a particular
ResourceReferenceRequestHandler should be mapped:
// see if request handler addresses the resource we serve
if (resourceReference.getResource().equals(handler.getResource()) == false)
{
return null;
}
Unfortunately this if statement always evaluates to true and thus null is
returned.
The problem is that IResource implementations do not provide an equals()
method. In practice this means that the default Object#equals() implementation
is used, which nearly always results in false for the equality test.
I see two possible solutions:
1. Implement equals() for all IResource classes.
2. Compare the ResourceReference objects instead, which already have a
meaningful equals() implementation. In other words:
// see if request handler addresses the resource we serve
if (resourceReference.equals(handler.getResourceReference()) == false)
{
return null;
}
I'm attaching a quickstart that illustrates this bug.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira