You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Matt Brictson (JIRA)" <ji...@apache.org> on 2011/03/05 00:04:45 UTC

[jira] Created: (WICKET-3506) ResourceMapper doesn't work: mapHandler() always returns null

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

        

[jira] Assigned: (WICKET-3506) ResourceMapper doesn't work: mapHandler() always returns null

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-3506:
-------------------------------------

    Assignee: Igor Vaynberg

> 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
>            Assignee: Igor Vaynberg
>         Attachments: quickstart-WICKET-3506.tgz
>
>
> 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

[jira] Resolved: (WICKET-3506) ResourceMapper doesn't work: mapHandler() always returns null

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3506.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-RC3

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-RC3
>
>         Attachments: quickstart-WICKET-3506.tgz
>
>
> 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

[jira] Updated: (WICKET-3506) ResourceMapper doesn't work: mapHandler() always returns null

Posted by "Matt Brictson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Brictson updated WICKET-3506:
----------------------------------

    Attachment: quickstart-WICKET-3506.tgz

Quickstart illustrating the bug.

> 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
>         Attachments: quickstart-WICKET-3506.tgz
>
>
> 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