portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r1002952 - /portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
Date Thu, 30 Sep 2010 06:21:03 GMT
Author: woonsan
Date: Thu Sep 30 06:21:03 2010
New Revision: 1002952

URL: http://svn.apache.org/viewvc?rev=1002952&view=rev
Log:
JS2-1219: Checking if portlet definition is null in portlet window because a portlet window
can be created when a valid portlet definition is not found in the portlet registry.

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

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java?rev=1002952&r1=1002951&r2=1002952&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
Thu Sep 30 06:21:03 2010
@@ -50,6 +50,7 @@ import org.apache.jetspeed.locator.Templ
 import org.apache.jetspeed.locator.TemplateLocatorException;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.portlet.HeadElement;
 import org.apache.jetspeed.portlet.HeaderPhaseSupportConstants;
 import org.apache.jetspeed.request.RequestContext;
@@ -715,17 +716,27 @@ public class JetspeedPowerToolImpl imple
             if (title == null)
             {
                 PortletWindow portletWindow = requestContext.getPortletWindow(f);
-            
+                
                 if (portletWindow != null)
                 {
-                    title = requestContext.getPreferedLanguage(portletWindow.getPortletDefinition()).getTitle();
+                    // When a portlet definition is not found from the registry,
+                    // portlet windows do not have portlet definition.
+                    // So, we have to check if the portlet definition is null or not. 
+                    
+                    PortletDefinition portletDef = portletWindow.getPortletDefinition();
                     
-                    if (title == null)
+                    if (portletDef != null)
                     {
-                        title = portletWindow.getPortletDefinition().getPortletName();
+                        title = requestContext.getPreferedLanguage(portletDef).getTitle();
+                        
+                        if (title == null)
+                        {
+                            title = portletDef.getPortletName();
+                        }
                     }
                 }
-                else
+                
+                if (title == null)
                 {
                     title = f.getName();
                     



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