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

HeaderRequestPhaseListener and RenderRequestPhaseListener perform synchronization on a non-final field

    Details

      Description

      HeaderRequestPhaseListener.java (in the master/6.x/5.x branch) and RenderRequestPhaseListener.java (in the 4.x/3.x/2.x branch) of liferay-faces-bridge-impl.git contain the following code:

      @Override
      public void afterPhase(PhaseEvent phaseEvent) {
      
      	FacesContext facesContext = phaseEvent.getFacesContext();
      
      	if (VIEW_PARAMETERS_ENABLED == null) {
      
      		synchronized (phaseId) {
      
      			if (VIEW_PARAMETERS_ENABLED == null) {
      
      				PortletConfig portletConfig = RequestMapUtil.getPortletConfig(facesContext);
      				VIEW_PARAMETERS_ENABLED = isViewParametersEnabled(portletConfig);
      			}
      		}
      	}
      	...
      }
      

      However, IDE's give a warning that synchronization is happening on on a non-final field. Changing to synchronized (this) should fix the problem.

        Attachments

          Activity

            People

            Assignee:
            neil.griffin Neil Griffin
            Reporter:
            neil.griffin Neil Griffin
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Packages

                Version Package
                bridge-impl-2.1.0
                bridge-impl-3.1.0
                bridge-impl-4.1.0