Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-730

WeldApplication shouldn't assume FacesContext is available when attempting lazy initialization

    XMLWordPrintable

Details

    • Compatibility/Configuration
    • Low

    Description

      WeldApplication uses a forwarding wrapper around the delegate JSF Application object in order to get around the fact that BeanManager may not have been initialized at the time JSF is initializing. However, it assumes that the first use of Application will be during a faces request, where FacesContext is available. However, the JSF Application object is permitted to be accessed outside of the faces lifecycle (such as in a Servlet filter). When this occurs, a NullPointerException in WeldApplication results.

      WeldApplication should skip the BeanManager lookup if the FacesContext is null.

      private BeanManager beanManager()
      {
      FacesContext facesContext;
      if (beanManager != null && (facesContext = FacesContext.getCurrentInstance()) != null)

      { // lookup BeanManager }

      }

      Attachments

        Activity

          People

            dan.j.allen Dan Allen (Inactive)
            dan.j.allen Dan Allen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: