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

        

Reply via email to