portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r587333 - /portals/jetspeed-2/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java
Date Tue, 23 Oct 2007 00:30:37 GMT
Author: taylor
Date: Mon Oct 22 17:30:36 2007
New Revision: 587333

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

global useNameCache was causing problems with multithreaded testing

Modified:
    portals/jetspeed-2/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java

Modified: portals/jetspeed-2/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java?rev=587333&r1=587332&r2=587333&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java
(original)
+++ portals/jetspeed-2/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java
Mon Oct 22 17:30:36 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


Mime
View raw message