Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3745

No need to set FACELET_CONTEXT_KEY in DefaultFaceletContext constructor

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.0.18, 2.1.12
    • Fix Version/s: 2.0.19, 2.1.13
    • Component/s: JSR-314
    • Labels:
      None

      Description

      In MYFACES-3246 the following constructor was updated:

      DefaultFaceletContext(FacesContext faces, AbstractFacelet facelet, FaceletCompositionContext mctx)

      It no longer does the following:

      //Set FACELET_CONTEXT_KEY on FacesContext attribute map, to
      //reflect the current facelet context instance
      faces.getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, this);

      Setting the FACELET_CONTEXT_KEY is now done where ever the DefaultFaceletContext is created for instance in DefaultFacelet.

      DefaultFaceletContext ctxWrapper = new DefaultFaceletContext((DefaultFaceletContext)ctx, this, false);
      ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctxWrapper);

      However, the other constructor which is actually being called above still sets the FACELET_CONTEXT_KEY and so it is set in the constructor and then set again directly after creation.

      //Update FACELET_CONTEXT_KEY on FacesContext attribute map, to
      //reflect the current facelet context instance
      ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, this);

      I think this was just an oversight when fixing this bug. But I think we should clean this up and I'll provide the trivial patch that can be applied.

        Attachments

        1. MyFaces-3745.patch
          0.9 kB
          Paul Nicolucci

          Activity

            People

            • Assignee:
              lu4242 Leonardo Uribe
              Reporter:
              paul.nicolucci Paul Nicolucci
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified