portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r331175 - /portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java
Date Mon, 07 Nov 2005 01:51:29 GMT
Author: ate
Date: Sun Nov  6 17:51:23 2005
New Revision: 331175

URL: http://svn.apache.org/viewcvs?rev=331175&view=rev
Log:
A few small improvements in invalid argument handling to be Portlet API compliant. 

Modified:
    portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java

Modified: portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java?rev=331175&r1=331174&r2=331175&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java
(original)
+++ portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java
Sun Nov  6 17:51:23 2005
@@ -77,21 +77,47 @@
     public javax.portlet.PortletRequestDispatcher getRequestDispatcher(String path)
     {
         String localizedPath = localizePath(path, this.application);
-        RequestDispatcher rd = servletContext.getRequestDispatcher(localizedPath);
-
+        RequestDispatcher rd = null;
+        
+        try
+        {
+            rd = servletContext.getRequestDispatcher(localizedPath);
+        }
+        catch (Exception e)
+        {
+            // Portlet API says: return null
+        }
 
         // TODO: factory
-        return new JetspeedRequestDispatcher(rd);
+        if ( rd != null )
+        {
+            return new JetspeedRequestDispatcher(rd);
+        }
+        return null;
     }
 
     public PortletRequestDispatcher getNamedDispatcher(String name)
     {
         // TODO: localize name
 
-        RequestDispatcher rd = servletContext.getNamedDispatcher(name);
+        RequestDispatcher rd = null;
+        
+        try
+        {
+            rd = servletContext.getNamedDispatcher(name);
+        }
+        catch (Exception e)
+        {
+            // Portlet API says: return null
+        }
+        
         // TODO: factory
 
-        return new JetspeedRequestDispatcher(rd);
+        if ( rd != null )
+        {
+            return new JetspeedRequestDispatcher(rd);
+        }
+        return null;
     }
 
     public String getMimeType(String file)
@@ -106,6 +132,11 @@
 
     public java.lang.Object getAttribute(java.lang.String name)
     {
+        if ( name == null )
+        {
+            throw new IllegalArgumentException("Required parameter name is null");
+        }
+        
         if (name.startsWith("cps:"))
         {
             String serviceName = name.substring("cps:".length());
@@ -169,6 +200,10 @@
 
     public java.lang.String getInitParameter(java.lang.String name)
     {
+        if ( name == null )
+        {
+            throw new IllegalArgumentException("Required parameter name is null");
+        }
         return servletContext.getInitParameter(name);
     }
 



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