Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.0.2 CE GA3, 7.0.X EE, Master
-
7.0.x
-
Committed
-
3
-
Accept
Description
There is a bug in the initServletContainerInitializers method of com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor in Liferay Portal 7. The bug occurs whenever there is a META-INF/services/javax.servlet.ServletContainerInitializer file with more than one class name in one of the JARs in the WEB-INF/lib directory of a WAR that is deployed to Liferay Portal 7. In addition, the bug also occurs if there is a META-INF/services/javax.servlet.ServletContainerInitializer file with a comment in one of the JARs in the WEB-INF/lib directory of a WAR that is deployed to Liferay Portal 7.
The specification of the META-INF/services/javax.servlet.ServletContainerInitializer file is described at http://docs.oracle.com/javase/8/docs/api/index.html?java/util/ServiceLoader.html, and this specification allows multiple ServletContainerInitializer classes to be listed in the META-INF/services/javax.servlet.ServletContainerInitializer file. In addition, comments beginning with the # character are also allowed in this file according to this specification. However, the initServletContainerInitializers method in WabBundleProcessor fails to correctly process META-INF/services/javax.servlet.ServletContainerInitializer files that contain comments or multiple ServletContainerInitializer class names, both of which are permitted by the specification for META-INF/services/javax.servlet.ServletContainerInitializer files.
Steps to reproduce:
- Deploy attached portlet (com.lps72753.sample-1.0-SNAPSHOT.war)
- Access http://localhost:8080/o/com.lps72753.sample-1.0-SNAPSHOT/foo
Expected behavior, youcan see these 3 messages:
context attribute was set properly from Initializer! context attribute was set properly from Initializer2! context attribute was set properly from Initializer3WithComment!
Actual behavior: previous three messages aren't showing, or just some of them.