[ 
http://jira.nuxeo.org/browse/NXP-2261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34765#action_34765
 ] 

Olivier Grisel commented on NXP-2261:
-------------------------------------

Actually this won't be a problem for restlets as they have a simpler way to 
fetch the principal from the Servlet request context. 

However this should not crash with a SPE be throw an informative exception or 
return null and log a meaningful warning instead.

> UserSessionBean currentUser factory crashes with NPE when called from a 
> non-JSF context
> ---------------------------------------------------------------------------------------
>
>                 Key: NXP-2261
>                 URL: http://jira.nuxeo.org/browse/NXP-2261
>             Project: Nuxeo Enterprise Platform 5
>          Issue Type: Bug
>    Affects Versions: 5.1.4
>            Reporter: Olivier Grisel
>            Assignee: Alexandre Russel
>             Fix For: 5.1.5
>
>   Original Estimate: 4 hours
>  Remaining Estimate: 4 hours
>
> FacesContext.getCurrentInstance() is null in :
>     @Factory(value = "currentUser", scope = SESSION)
>     public Principal getCurrentUser() throws Exception {
>         if (currentUser == null) {
>             ExternalContext context = 
> FacesContext.getCurrentInstance().getExternalContext();
>             currentUser = context.getUserPrincipal();
>         }
>         return currentUser;
>     }
> UserSessionBean use to be a SFSB able it fetch the principal from the EJB 
> context when FacesContext.getCurrentInstance() is null.
> The JSF context is null when using Seam enabled restlet used by the LiveEdit 
> client, for instance:
>   http://localhost:8080/nuxeo/restAPI/creationContainerList?docType=File
> (CreationContainerListRestlet)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to