Author: ate
Date: Thu Apr 13 13:48:01 2006
New Revision: 393927

URL: http://svn.apache.org/viewcvs?rev=393927&view=rev
Log:
Correcting fix for JS2-315 which always leads to an IllegalArgumentException 
when a PortletDefinition isn't found.
Only cache a newly created PortletWindow which references a valid (existing) 
PortletEntity. 
See: http://issues.us.apache.org/jira/browse/JS2-315

Modified:
    
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java

Modified: 
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java?rev=393927&r1=393926&r2=393927&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java
 (original)
+++ 
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java
 Thu Apr 13 13:48:01 2006
@@ -47,6 +47,7 @@
     protected final static Log log = 
LogFactory.getLog(PortletWindowAccessorImpl.class);
    
     private Map windows = Collections.synchronizedMap(new HashMap());    
+        
     private PortletEntityAccessComponent entityAccessor;
     private boolean validateWindows = false;
     
@@ -167,8 +168,9 @@
     }
     
     private PortletWindow createPortletWindow(ContentFragment fragment, String 
principal) throws FailedToCreateWindowException, PortletEntityNotStoredException
-    {
+    {        
         PortletWindow portletWindow = new PortletWindowImpl(fragment.getId());
+        boolean temporaryWindow = false;
                 
         MutablePortletEntity portletEntity = 
entityAccessor.getPortletEntityForFragment(fragment, principal);
         if (portletEntity == null)
@@ -182,6 +184,11 @@
                 {
                     entityAccessor.storePortletEntity(portletEntity);
                 }
+                else
+                {
+                    // don't cache the incomplete window
+                    temporaryWindow = true;
+                }
             }
             catch (PortletEntityNotGeneratedException e)
             {
@@ -200,8 +207,10 @@
         }
         ((PortletWindowCtrl) portletWindow).setPortletEntity(portletEntity);
         
-        windows.put(fragment.getId(), portletWindow);       
-        
+        if ( !temporaryWindow )
+        {
+            windows.put(fragment.getId(), portletWindow);       
+        }
         
         return portletWindow;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to