portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r774468 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml: CastorFileSystemDocumentHandler.java FileSystemFolderHandler.java
Date Wed, 13 May 2009 18:22:47 GMT
Author: rwatler
Date: Wed May 13 18:22:42 2009
New Revision: 774468

URL: http://svn.apache.org/viewvc?rev=774468&view=rev
Log:
JS2-1007: protect PSML cache update/refresh logic from missing parent folder caused by concurrent
page manager node loading from PSML files

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/CastorFileSystemDocumentHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/CastorFileSystemDocumentHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/CastorFileSystemDocumentHandler.java?rev=774468&r1=774467&r2=774468&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/CastorFileSystemDocumentHandler.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/CastorFileSystemDocumentHandler.java
Wed May 13 18:22:42 2009
@@ -707,20 +707,16 @@
         if (entry.getDocument() instanceof Document && ((Document) entry.getDocument()).getPath().endsWith(documentType))
         {
             Document document = (Document) entry.getDocument();
-            Document freshDoc = getDocument(document.getPath(), false);
             Node parent = ((AbstractNode)document).getParent(false);
- 
-            freshDoc.setParent(parent);
-            if(parent instanceof FolderImpl)
+            if (parent instanceof FolderImpl)
             {
-                FolderImpl folder = (FolderImpl) parent;
-                folder.getAllNodes().add(freshDoc);
+                Document freshDoc = getDocument(document.getPath(), false);
+                freshDoc.setParent(parent);
+                ((FolderImpl)parent).getAllNodes().add(freshDoc);
+                freshDoc.setPath(document.getPath());
+                entry.setDocument(freshDoc);
             }
-            
-            freshDoc.setPath(document.getPath());
-            entry.setDocument(freshDoc);            
         }
-
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java?rev=774468&r1=774467&r2=774468&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/document/psml/FileSystemFolderHandler.java
Wed May 13 18:22:42 2009
@@ -715,31 +715,35 @@
      */
     public void refresh( FileCacheEntry entry ) throws Exception
     {
-        if (entry.getDocument() instanceof Folder )
+        if (entry.getDocument() instanceof Folder)
         {
             Folder folder = (Folder) entry.getDocument();            
             entry.setDocument(getFolder(folder.getPath(), false));
-            if (((AbstractNode)folder).getParent(false) != null)
+            Node parentNode = ((AbstractNode)folder).getParent(false);
+            if (parentNode != null)
             {
-                FileCacheEntry parentEntry = fileCache.get(((AbstractNode)folder).getParent(false).getPath());
+                FileCacheEntry parentEntry = fileCache.get(parentNode.getPath());
                 refresh(parentEntry);                
             }
         }
-        else if(entry.getDocument() instanceof Document)
+        else if (entry.getDocument() instanceof Document)
         {
             Document doc = (Document) entry.getDocument();
             if (doc.getType().equals(FolderMetaDataImpl.DOCUMENT_TYPE))
             {
-                FileCacheEntry folderEntry = fileCache.get(((AbstractNode)doc).getParent().getPath());
-                refresh(folderEntry);
+                Node folderNode = ((AbstractNode)doc).getParent(false);
+                if (folderNode != null)
+                {                
+                    FileCacheEntry folderEntry = fileCache.get(folderNode.getPath());
+                    refresh(folderEntry);
+                }
             }
         }
         
-        if(entry.getDocument() instanceof Reset)
+        if (entry.getDocument() instanceof Reset)
         {
             ((Reset)entry.getDocument()).reset();
         }
-
     }
 
     /**



---------------------------------------------------------------------
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