You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Andraschko (Jira)" <de...@myfaces.apache.org> on 2023/10/08 15:32:00 UTC

[jira] [Resolved] (MYFACES-4633) Suspicious Logic when setting BeanManager from JNDI

     [ https://issues.apache.org/jira/browse/MYFACES-4633?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Andraschko resolved MYFACES-4633.
----------------------------------------
    Resolution: Fixed

> Suspicious Logic when setting BeanManager from JNDI
> ---------------------------------------------------
>
>                 Key: MYFACES-4633
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4633
>             Project: MyFaces Core
>          Issue Type: Bug
>            Reporter: James McLeod
>            Priority: Major
>             Fix For: 4.0.2, 4.1.0
>
>         Attachments: beanmanager-init-from-jndi.patch
>
>
> Function {{private}} BeanManager lookupBeanManagerFromJndi() in [FacesInitializerImpl|https://github.com/apache/myfaces/blob/main/impl/src/main/java/org/apache/myfaces/webapp/FacesInitializerImpl.java] (specifically [line 594 of the current version|https://github.com/apache/myfaces/blob/7905297aee87def27bd77975e07545f2e59aa357/impl/src/main/java/org/apache/myfaces/webapp/FacesInitializerImpl.java#L594] looks incorrect to me.
> The logic in the function is:
>  # Try to retrieve {{beanManager}} as {{java:comp/BeanManager}} in {{InitialContext}}
>  # If this succeeds (i.e. {{beanManager}} is non-null), try to retrieve {{beanManager}} as {{java:comp/env/BeanManager}} in {{InitialContext}}
> The second step should be done if the first attempt to retrieve {{beanManager}} fails, not if it succeeds. (If my interpretation is wrong, I think an explanatory comment is warranted here!)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)