Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2371

NullPointerException on UIComponentClassicTagBase.getViewComponentIds() fixed on branch 2.0.x but not on branch 1.2.x

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.7
    • 1.2.8
    • None
    • None

    Description

      The problem occurs when the user wants to access to a .jsp page that includes a <f:subview> tag.

      It seems to be a bug on UIComponentClassicTagBase.getViewComponentIds(). It was fixed on 2.0.x branch but not on 1.2.x in this way:

      before:

      private Map<String,Object> getViewComponentIds()
      {
      Map<String, Object> requestMap = _facesContext.getExternalContext().getRequestMap();
      Map<String, Object> viewComponentIds;

      if (_parent == null)

      { // top level _componentInstance viewComponentIds = new HashMap<String,Object>(); requestMap.put(VIEW_IDS, viewComponentIds); }

      else

      { viewComponentIds = (Map<String, Object>) requestMap.get(VIEW_IDS); }

      return viewComponentIds;
      }

      After:

      private Map<String, Object> getViewComponentIds()
      {
      Map<String, Object> requestMap = _facesContext.getExternalContext().getRequestMap();
      Map<String, Object> viewComponentIds;

      if (_parent == null)

      { // top level _componentInstance viewComponentIds = new HashMap<String, Object>(); requestMap.put(VIEW_IDS, viewComponentIds); }

      else
      {
      viewComponentIds = (Map<String, Object>)requestMap.get(VIEW_IDS);

      // Check if null, this can happen if someone programatically tries to do an include of a
      // JSP fragment. This code will prevent NullPointerException from happening in such cases.
      if (viewComponentIds == null)

      { viewComponentIds = new HashMap<String, Object>(); requestMap.put(VIEW_IDS, viewComponentIds); }

      }

      return viewComponentIds;
      }

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            asuka_l2 Asuka Langley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: