You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Tim Williams (JIRA)" <ji...@apache.org> on 2005/06/07 23:59:41 UTC

[jira] Created: (FOR-526) "exists" selector tests true when unresolvable locationmap hint is passed

"exists" selector tests true when unresolvable locationmap hint is passed
-------------------------------------------------------------------------

         Key: FOR-526
         URL: http://issues.apache.org/jira/browse/FOR-526
     Project: Forrest
        Type: Bug
  Components: Core operations  
    Versions: 0.7-dev    
 Environment: 0.7 locationmap branch
    Reporter: Tim Williams
    Priority: Minor


As described in the bottom mails on this thread:
http://marc.theaimsgroup.com/?t=111793036600001&r=1&w=2

Essentially, when a {lm:var} is passed to the test of an exists selector, if the locationmap "hint" doesn't exist in locationmap.xml, then LocationMapModule is properly resolving to null but the SourceExistsSelector resolves the URI to "$FORREST_HOME/main/webapp/".  A workaround is to put a null and empty string test in SourceExistsSelector.select() before the call to resolveURI().  This may very well be a bug outside of Forrest since the LocationMapModule is properly resolving non-existent hints to null.  
--tim

Here's the patch for the workaround.

Index: SourceExistsSelector.java
===================================================================
--- SourceExistsSelector.java	(revision 188836)
+++ SourceExistsSelector.java	(working copy)
@@ -76,6 +76,10 @@
     public boolean select(String uri, Map objectModel, Parameters parameters) {
         Source src = null;
         try {
+        
+        		if (uri == null || uri == "")
+					return false;
+					
             src = resolver.resolveURI(uri);
             if (src.exists()) {
                 return true;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (FOR-526) "exists" selector tests true when unresolvable locationmap hint is passed

Posted by "Ross Gardler (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/FOR-526?page=all ]
     
Ross Gardler closed FOR-526:
----------------------------

    Resolution: Fixed
     Assign To: Ross Gardler

Applied with minor modifications (moved outside try block and used braces around if as per code convent of rest of file)

> "exists" selector tests true when unresolvable locationmap hint is passed
> -------------------------------------------------------------------------
>
>          Key: FOR-526
>          URL: http://issues.apache.org/jira/browse/FOR-526
>      Project: Forrest
>         Type: Bug
>   Components: Core operations
>     Versions: 0.7-dev
>  Environment: 0.7 locationmap branch
>     Reporter: Tim Williams
>     Assignee: Ross Gardler
>     Priority: Minor

>
> As described in the bottom mails on this thread:
> http://marc.theaimsgroup.com/?t=111793036600001&r=1&w=2
> Essentially, when a {lm:var} is passed to the test of an exists selector, if the locationmap "hint" doesn't exist in locationmap.xml, then LocationMapModule is properly resolving to null but the SourceExistsSelector resolves the URI to "$FORREST_HOME/main/webapp/".  A workaround is to put a null and empty string test in SourceExistsSelector.select() before the call to resolveURI().  This may very well be a bug outside of Forrest since the LocationMapModule is properly resolving non-existent hints to null.  
> --tim
> Here's the patch for the workaround.
> Index: SourceExistsSelector.java
> ===================================================================
> --- SourceExistsSelector.java	(revision 188836)
> +++ SourceExistsSelector.java	(working copy)
> @@ -76,6 +76,10 @@
>      public boolean select(String uri, Map objectModel, Parameters parameters) {
>          Source src = null;
>          try {
> +        
> +        		if (uri == null || uri == "")
> +					return false;
> +					
>              src = resolver.resolveURI(uri);
>              if (src.exists()) {
>                  return true;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira