"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