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 2009/03/31 08:31:59 UTC

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

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: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org