You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2005/06/10 15:03:39 UTC

svn commit: r189953 - /forrest/branches/locationmap_branch/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java

Author: rgardler
Date: Fri Jun 10 06:03:38 2005
New Revision: 189953

URL: http://svn.apache.org/viewcvs?rev=189953&view=rev
Log:
Check for null or empty values when validating a source exists (Thanks to Tim WIlliams)

Modified:
    forrest/branches/locationmap_branch/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java

Modified: forrest/branches/locationmap_branch/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java?rev=189953&r1=189952&r2=189953&view=diff
==============================================================================
--- forrest/branches/locationmap_branch/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java (original)
+++ forrest/branches/locationmap_branch/main/java/org/apache/forrest/sourceexists/SourceExistsSelector.java Fri Jun 10 06:03:38 2005
@@ -75,6 +75,15 @@
     /** Return true if Source 'uri' resolves and exists. */
     public boolean select(String uri, Map objectModel, Parameters parameters) {
         Source src = null;
+        
+        // The locationmap module will return null if there is no match for
+        // the supplied hint, without the following the URI will be resolved to
+        // the context root, which always exists, but does not contain a valid
+        // resource.
+        if (uri == null || uri == "") {
+           return false; 
+        }
+        
         try {
             src = resolver.resolveURI(uri);
             if (src.exists()) {