Author: taylor
Date: Tue Mar 31 06:31:57 2009
New Revision: 760344

URL: http://svn.apache.org/viewvc?rev=760344&view=rev
Log:
Bug fix (and NPE) from http://svn.apache.org/viewvc?view=rev&revision=760174 
Navigational State constructor was NPE'ing in spring assembly during servlet 
initialization. Furthermore, Request Context is *not* available of course (as 
of now) during Spring initialization. And then, there is of course the *adding* 
check for the null RC

Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/JetspeedPortalContext.java

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/JetspeedPortalContext.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/JetspeedPortalContext.java?rev=760344&r1=760343&r2=760344&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/JetspeedPortalContext.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/JetspeedPortalContext.java
 Tue Mar 31 06:31:57 2009
@@ -28,6 +28,7 @@
 import org.apache.jetspeed.administration.PortalConfiguration;
 import org.apache.jetspeed.container.PortletWindow;
 import org.apache.jetspeed.engine.Engine;
+import org.apache.jetspeed.request.RequestContext;
 
 /**
  * Implementation of Portal Context associated with running thread of the 
engine
@@ -219,10 +220,14 @@
     
     private Collection getSupportedModes()
     {
-        PortletWindow window = 
Jetspeed.getCurrentRequestContext().getCurrentPortletWindow();
-        if (window != null)
+        RequestContext rc = Jetspeed.getCurrentRequestContext();
+        if (rc != null)
         {
-            return 
window.getPortletDefinition().getApplication().getSupportedPortletModes();
+            PortletWindow window  = rc.getCurrentPortletWindow();
+            if (window != null)
+            {
+                return 
window.getPortletDefinition().getApplication().getSupportedPortletModes();
+            }
         }
         return JetspeedActions.getStandardPortletModes();
     }
@@ -242,10 +247,14 @@
 
     private Collection getSupportedStates()
     {
-        PortletWindow window = 
Jetspeed.getCurrentRequestContext().getCurrentPortletWindow();
-        if (window != null)
-        {
-            return 
window.getPortletDefinition().getApplication().getSupportedWindowStates();
+        RequestContext rc = Jetspeed.getCurrentRequestContext();
+        if (rc != null)
+        {        
+            PortletWindow window = rc.getCurrentPortletWindow();
+            if (window != null)
+            {
+                return 
window.getPortletDefinition().getApplication().getSupportedWindowStates();
+            }
         }
         return JetspeedActions.getStandardWindowStates();
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to