code: private FacesContext getFacesContext()
     {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext == null) {
           throw new IllegalArgumentException(
                    "FacesContext.getCurrentInstance() returned null. EL expressions can only be evaluated in the JSF lifecycle. "
                             + "You should use PhaseAction and PhaseBinding to perform a deferred operation instead.");
        }
        return facesContext;
     }
docs: Obtains the {@link FacesContext} using {@link FacesContext#getCurrentInstance()}. This method will throw an
  {@link IllegalArgumentException} if the {@link FacesContext} is not available.