You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Michael Freedman (JIRA)" <de...@myfaces.apache.org> on 2011/03/01 18:15:36 UTC

[jira] Created: (PORTLETBRIDGE-184) Bridge NPE in resolving scope during resource request if scope has been removed from cache

Bridge NPE in resolving scope during resource request if scope has been removed from cache
------------------------------------------------------------------------------------------

                 Key: PORTLETBRIDGE-184
                 URL: https://issues.apache.org/jira/browse/PORTLETBRIDGE-184
             Project: MyFaces Portlet Bridge
          Issue Type: Bug
          Components: Impl
    Affects Versions: 2.0.0
            Reporter: Michael Freedman
            Assignee: Michael Freedman


If the Bridge receives a scopeid in the incoming request during a resource request and that scope isn't in the cache (it has been removed) then the bridge throws a NPE as it doesn't include a check to ensure that the map returned from looking up the scopeId isn't null.  

Code currently reads like this:
  private String getResourceRequestScopeId(ExternalContext extCtx, PortletRequest request)
  {

    // get the render scope this resource request is contained in
    String scopeId = getRequestScopeId(request);
       
    if (scopeId == null)
    {
      // first request is a resource request
      // create a scope and store in the session until an action occurs
      // pass null as we aren't a StateAwareResponse
      return initBridgeRequestScope(request, null);
    }
    
    // Check to see if this resource request is targeting the same view or a different one
    Map<String, Object> m = getScopeMap(scopeId);
    Map<String, String> childResourceScopeMap = (Map<String, String>) m.get(CHILD_RESOURCE_REQUEST_SCOPE_MAP);
    String scopeIdKey = (String) m.get(SCOPE_VIEW_KEY);
    String childIdKey = getScopeViewKey(extCtx);

Instead code should check for null return from geetScopeMap and if null init a new bridge RequestScope.  

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (PORTLETBRIDGE-184) Bridge NPE in resolving scope during resource request if scope has been removed from cache

Posted by "Michael Freedman (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/PORTLETBRIDGE-184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Freedman resolved PORTLETBRIDGE-184.
--------------------------------------------

    Resolution: Duplicate

Inadvertently opened duplicate second bug: PORTLETBRIDGE-185 and updated/marked that one fixed.

> Bridge NPE in resolving scope during resource request if scope has been removed from cache
> ------------------------------------------------------------------------------------------
>
>                 Key: PORTLETBRIDGE-184
>                 URL: https://issues.apache.org/jira/browse/PORTLETBRIDGE-184
>             Project: MyFaces Portlet Bridge
>          Issue Type: Bug
>          Components: Impl
>    Affects Versions: 2.0.0
>            Reporter: Michael Freedman
>            Assignee: Michael Freedman
>
> If the Bridge receives a scopeid in the incoming request during a resource request and that scope isn't in the cache (it has been removed) then the bridge throws a NPE as it doesn't include a check to ensure that the map returned from looking up the scopeId isn't null.  
> Code currently reads like this:
>   private String getResourceRequestScopeId(ExternalContext extCtx, PortletRequest request)
>   {
>     // get the render scope this resource request is contained in
>     String scopeId = getRequestScopeId(request);
>        
>     if (scopeId == null)
>     {
>       // first request is a resource request
>       // create a scope and store in the session until an action occurs
>       // pass null as we aren't a StateAwareResponse
>       return initBridgeRequestScope(request, null);
>     }
>     
>     // Check to see if this resource request is targeting the same view or a different one
>     Map<String, Object> m = getScopeMap(scopeId);
>     Map<String, String> childResourceScopeMap = (Map<String, String>) m.get(CHILD_RESOURCE_REQUEST_SCOPE_MAP);
>     String scopeIdKey = (String) m.get(SCOPE_VIEW_KEY);
>     String childIdKey = getScopeViewKey(extCtx);
> Instead code should check for null return from geetScopeMap and if null init a new bridge RequestScope.  

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira