You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2007/10/23 02:30:50 UTC

svn commit: r587334 - /portals/jetspeed-2/branches/JETSPEED-2.1.3/components/locator/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java

Author: taylor
Date: Mon Oct 22 17:30:49 2007
New Revision: 587334

URL: http://svn.apache.org/viewvc?rev=587334&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-785

global useNameCache was causing problems with multithreaded testing

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/locator/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/locator/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/locator/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java?rev=587334&r1=587333&r2=587334&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/locator/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java (original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/locator/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java Mon Oct 22 17:30:49 2007
@@ -136,18 +136,16 @@
     {
         for (int ix = 0; ix < roots.size(); ix++)
         {        
-            TemplateDescriptor template = locateTemplate(locator, (String)roots.get(ix));
+            TemplateDescriptor template = locateTemplate(locator, (String)roots.get(ix), this.useNameCache);
             if (null == template)
             {
                 // Try to locate it directly on file system, perhaps it was recently added
-                useNameCache = false;
-                template = locateTemplate(locator, (String)roots.get(ix));
+                template = locateTemplate(locator, (String)roots.get(ix), false);
                 if (null != template)
                 {
                     // add it to the map
                     templateMap.put(template.getAbsolutePath(), null);
                 }
-                useNameCache = true;   
             }
             if (template != null)
             {
@@ -166,7 +164,7 @@
      *
      * @return TemplateDescriptor the exact path to the template, or null if not found.
      */
-    private TemplateDescriptor locateTemplate(LocatorDescriptor locator, String root)
+    private TemplateDescriptor locateTemplate(LocatorDescriptor locator, String root, boolean useCache)
     {
         String templateName = locator.getName();       
         String path = locator.toPath();
@@ -183,7 +181,7 @@
             realPath = root + workingPath;
 
             // the current template exists, return the corresponding path
-            if (templateExists(realPath))
+            if (templateExists(realPath, useCache))
             {
                 if (log.isDebugEnabled())
                 {
@@ -213,19 +211,23 @@
      *
      * @return True when the template is found, otherwise false.
      */
-    public boolean templateExists(String templateKey)
+    public boolean templateExists(String templateKey, boolean useCache)
     {
         if (null == templateKey)
         {
             return false;
         }
-        if (useNameCache == true)
+        if (useCache == true)
         {
             return templateMap.containsKey(templateKey);
         }
         return (new File(templateKey).exists());
     }
-    
+
+    public boolean templateExists(String templateKey)
+    {
+        return templateExists(templateKey, this.useNameCache);
+    }
    
     public LocatorDescriptor createFromString(String path)
         throws TemplateLocatorException



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org