weaver      2005/01/04 08:20:52

  Modified:    portal/src/java/org/apache/jetspeed/request
                        JetspeedRequestContextComponent.java
  Log:
  make failures more expilict
  
  Revision  Changes    Path
  1.9       +21 -3     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
  
  Index: JetspeedRequestContextComponent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JetspeedRequestContextComponent.java      11 Nov 2004 19:20:45 -0000      
1.8
  +++ JetspeedRequestContextComponent.java      4 Jan 2005 16:20:52 -0000       
1.9
  @@ -24,6 +24,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import org.apache.jetspeed.PortalReservedParameters;
   import org.apache.jetspeed.userinfo.UserInfoManager;
   
   /**
  @@ -100,12 +101,29 @@
        */
       public RequestContext getRequestContext(HttpServletRequest request)
       {
  -        return (RequestContext) 
request.getAttribute(RequestContext.REQUEST_PORTALENV);
  +        RequestContext rc = (RequestContext) 
request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
  +        if(rc != null)
  +        {
  +            return rc;
  +        }
  +        else
  +        {
  +            throw new IllegalStateException("Cannot call 
getRequestContext(HttpServletRequest request) before it has been created and 
set for this thread.");
  +        }
       }
       
       public RequestContext getRequestContext()
       {
  -        return (RequestContext) tlRequestContext.get();        
  +        RequestContext rc =  (RequestContext) tlRequestContext.get();        
  +        
  +        if(rc != null)
  +        {
  +            return rc;
  +        }
  +        else
  +        {
  +            throw new IllegalStateException("Cannot call getRequestContext() 
before it has been created and set for this thread.");
  +        }
       }
   
   }
  
  
  

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

Reply via email to