jakartaee / jakartaee/faces

FaceletCache: some caching is incorrectly done in DefaultFaceletFactory

Open
#1,121 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Facelets/VDL Priority: Minor Type: Bug
Dominant language
Java
Stars
127
Forks
59
Avg merge
23h
Merged PRs (30d)
7

Description

LU> I realized the FaceletCache API has a flaw.

LU> The original code from facelets 1.1.x has logic to cache the
LU> "conversion" between logical identifiers to find a specific facelet and
LU> its related URL.

LU> So inside DefaultFaceletFactory there is a map like this:

LU> private Map<String, URL> _relativeLocations;

LU> Checking the code deeper, I notice this cache store also the values
LU> returned by the ResourceResolver.

LU> Now suppose a scenario where you have a custom FaceletCache
LU> implementation, and by some coincidence there is some mechanism to load/
LU> unload some facelets in some way. Once a facelet is called,
LU> relativeLocations will hold the same key/value pair, so if a facelet is
LU> unloaded and then another one is loaded and it has the same association,
LU> it will fail to find the new one.

LU> A realistic scenario that will be part of JSF 2.2 spec is if you have
LU> a jar with some composite components and facelet files. For two
LU> different skins, there will be facelets with the same "logical
LU> identifiers", but with different URL. This issue prevents change the
LU> skins on the fly, because you can't clean that map.

LU> Who should hold that map? It should be hold by FaceletCache, not by
LU> FaceletFactory, because FaceletCache is the responsible to load/unload
LU> and hold facelets into memory.

Affected Versions

[2.2 Sprint 13]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing DefaultFaceletFactory and FaceletCache to identify where the logical-identifier-to-URL map is stored and how ResourceResolver results are cached. Verify the unload/reload and different-skin scenarios described in the issue, and consider the work complete when the cache owner can replace or clear those associations correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
web-dev
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.