You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2023/01/19 03:19:15 UTC

[tapestry-5] 01/03: TAP5-2744: bug fix in ComponentClassCacheImpl

This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch better-page-invalidation
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git

commit a225c3b76b30bedd7874317f219516f511fc03c5
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Wed Jan 18 22:09:22 2023 -0300

    TAP5-2744: bug fix in ComponentClassCacheImpl
---
 .../internal/services/ComponentClassCacheImpl.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassCacheImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassCacheImpl.java
index f8b4f139c..349189707 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassCacheImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassCacheImpl.java
@@ -54,15 +54,23 @@ public class ComponentClassCacheImpl implements ComponentClassCache
     private List<String> listen(List<String> resources)
     {
         
-        final Iterator<Entry<String, Class>> iterator = cache.entrySet().iterator();
-        
-        while (iterator.hasNext())
+        if (resources.isEmpty())
         {
-            final Entry<String, Class> entry = iterator.next();
-            if (resources.contains(entry.getKey()))
+            cache.clear();
+        }
+        else {
+        
+            final Iterator<Entry<String, Class>> iterator = cache.entrySet().iterator();
+            
+            while (iterator.hasNext())
             {
-                iterator.remove();
+                final Entry<String, Class> entry = iterator.next();
+                if (resources.contains(entry.getKey()))
+                {
+                    iterator.remove();
+                }
             }
+            
         }
         
         return Collections.emptyList();