Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-3245

Liferay Faces libraries save innapropriate values into static variables and constants



      The Liferay Faces artifacts have traditionally been included inside every war's WEB-INF/lib folder. In this situation, there is a separate version of every Liferay Faces class associated with each war and ServletContext. Because of this, certain constants and variables have been saved as static values since each class would interact with at most 1 ServletContext. However, when the Liferay Faces jars are included in $TOMCAT_HOME/lib or $LIFERAY_HOME/osgi/modules (where each jar can be associated with multiple ServletContext s), this pattern is a problem. For example, consider the following situation:

      1. Mojarra, the Liferay Faces jars, and PrimeFaces are included in $LIFERAY_HOME/osgi/modules.
      2. The JSF Showcase (thin-war) is deployed.
      3. RenderKitBridgeImpl will check if PrimeFaces is detected and save that detection into a static constant. In this case, since the JSF Showcase does not import any PrimeFaces packages, PrimeFaces will (correctly) not be detected.
      4. The PrimeFaces Applicant portlet is deployed.
      5. Now, since the detection of PrimeFaces was cached in static constant in the Bridge Impl, the Bridge will assume that PrimeFaces is not detected and never instantiate the HeadRendererPrimeFacesImpl causing serious problems like some PrimeFaces resources never being added to the page.

      The pattern of caching values in static variables and constants in the Liferay Faces jars breaks in any situation where Liferay Faces jars are designed to serve multiple wars and ServletContext s. Every static value in the Liferay Faces libraries needs to be examined to determine whether it may change for different ServletContext s. If it will change, the value must be removed and potentially saved on a per- ServletContext basis.




            • Assignee:
              kyle.stiemann Kyle Stiemann (Inactive)
              kyle.stiemann Kyle Stiemann (Inactive)
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:


                Version Package