You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Melloware (Jira)" <de...@myfaces.apache.org> on 2025/02/16 12:46:00 UTC
[jira] [Commented] (MYFACES-4711) Check with isAssignableFrom with final class
[ https://issues.apache.org/jira/browse/MYFACES-4711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17927498#comment-17927498 ]
Melloware commented on MYFACES-4711:
------------------------------------
[~milovanderzee]did you want to submit a PR?
> Check with isAssignableFrom with final class
> --------------------------------------------
>
> Key: MYFACES-4711
> URL: https://issues.apache.org/jira/browse/MYFACES-4711
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 4.1.0
> Reporter: Milo van der Zee
> Priority: Minor
>
>
> In FacesServletMappingUtils.java there is a function that checks if the servlet is a facesServlet (isFacesServlet).
>
> {code:java}
> public static boolean isFacesServlet(FacesContext facesContext, String servletClassName)
> {
> // shortcut to avoid class lookup
> if (FacesServlet.class.getName().equals(servletClassName))
> {
> return true;
> }
> Class servletClass = ClassUtils.simpleClassForName(servletClassName, false);
> if (servletClass != null)
> {
> MyfacesConfig config = MyfacesConfig.getCurrentInstance(facesContext);
>
> return FacesServlet.class.isAssignableFrom(servletClass)
> || DelegatedFacesServlet.class.isAssignableFrom(servletClass)
> || servletClass.getName().equals(config.getDelegateFacesServlet());
> }
> return false;
> }
> {code}
>
>
> The `FacesServlet.class.isAssignableFrom(servletClass)`check is not correct here:
> - FacesServlet is final and so checking for extends is useless
> - FacesServlet.class.getName().equals(servletClassName) already does the check
--
This message was sent by Atlassian Jira
(v8.20.10#820010)