This is an automated email from the ASF dual-hosted git repository. thiagohp pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/master by this push: new 24c5fe9b6 TAP5-2787: avoiding infinite loop in PageSourceImpl 24c5fe9b6 is described below commit 24c5fe9b6ee78816edf6c22b38879c370074efb6 Author: Thiago H. de Paula Figueiredo <thi...@arsmachina.com.br> AuthorDate: Sat Aug 31 12:02:50 2024 -0300 TAP5-2787: avoiding infinite loop in PageSourceImpl when multiple classloader mode on --- .../org/apache/tapestry5/internal/services/PageSourceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java index 38ab835fd..c4633cc29 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java @@ -113,6 +113,9 @@ public class PageSourceImpl implements PageSource private final static ThreadLocal<String> CURRENT_PAGE = ThreadLocal.withInitial(() -> null); + + private final static ThreadLocal<Set<String>> CALL_STACK = + ThreadLocal.withInitial(HashSet::new); public PageSourceImpl(PageLoader pageLoader, ComponentRequestSelectorAnalyzer selectorAnalyzer, ComponentDependencyRegistry componentDependencyRegistry, @@ -194,11 +197,13 @@ public class PageSourceImpl implements PageSource // Avoiding problems in PlasticClassPool.createTransformation() // when the class being loaded has a page superclass final List<String> pageDependencies = getPageDependencies(className); + CALL_STACK.get().add(className); for (String dependencyClassName : pageDependencies) { // Avoiding infinite recursion caused by circular dependencies - if (!alreadyProcessed.contains(dependencyClassName)) + if (!alreadyProcessed.contains(dependencyClassName) && + !CALL_STACK.get().contains(className)) { alreadyProcessed.add(dependencyClassName);