You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by wt...@apache.org on 2019/03/18 18:55:07 UTC

[myfaces] branch 2.2.x updated: avoid CNFE in getFacesServletMappings

This is an automated email from the ASF dual-hosted git repository.

wtlucy pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/2.2.x by this push:
     new 2d16989  avoid CNFE in getFacesServletMappings
     new c1e6daa  Merge pull request #48 from wtlucy/getFacesServletMappings_CNFE_2.2
2d16989 is described below

commit 2d16989c0f6b83cbcef3e18bfa69a0f84fad5bbc
Author: Bill Lucy <wt...@gmail.com>
AuthorDate: Fri Mar 15 15:37:16 2019 -0400

    avoid CNFE in getFacesServletMappings
---
 .../apache/myfaces/shared_impl/webapp/webxml/WebXml.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java
index d96d599..6a33cc0 100644
--- a/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java
+++ b/impl/src/main/java/org/apache/myfaces/shared_impl/webapp/webxml/WebXml.java
@@ -30,6 +30,7 @@ import javax.faces.context.ExternalContext;
 import javax.faces.webapp.FacesServlet;
 
 import org.apache.myfaces.shared.config.MyfacesConfig;
+import org.apache.myfaces.shared.util.ClassUtils;
 
 /**
  * @author Manfred Geiler (latest modification by $Author$)
@@ -133,7 +134,17 @@ public class WebXml
                 // </servlet>
                 continue;
             }
-            Class servletClass = org.apache.myfaces.shared.util.ClassUtils.simpleClassForName((String)entry.getValue());
+
+            Class servletClass = ClassUtils.simpleClassForName((String) entry.getValue(), false);
+            if (servletClass == null)
+            {
+                if (log.isLoggable(Level.FINEST))
+                {
+                    log.finest("ignoring servlet " + servletName + " because its class could not be loaded");
+                }
+                continue;
+            }
+
             if (FacesServlet.class.isAssignableFrom(servletClass) ||
                     DelegatedFacesServlet.class.isAssignableFrom(servletClass) ||
                     servletClass.getName().equals(_delegateFacesServlet))