[ 
https://issues.apache.org/jira/browse/WICKET-5291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13774668#comment-13774668
 ] 

Martin Grigorov commented on WICKET-5291:
-----------------------------------------

This fix seems to break a use case - 
org.apache.wicket.markup.head.ResourceAggregator#getItemToBeRendered may return 
a bundle for a HeaderItem, but if the header item is PriorityHeaderItem then 
the bundle looses the priority status and later 
org.apache.wicket.markup.head.PriorityFirstComparator#compare has no 
information about the priority and doesn't sort properly.

I have to create a proper unit test but the following change seems to fix the 
problem with our app:

--- 
i/wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java
+++ 
w/wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java
@@ -400,6 +400,19 @@ public class ResourceAggregator extends 
DecoratingHeaderResponse
                }
 
                HeaderItem bundle = 
Application.get().getResourceBundles().findBundle(innerItem);
-               return bundle == null ? item : bundle;
+               HeaderItem itemToBeRendered;
+               if (bundle == null)
+               {
+                       itemToBeRendered = item;
+               }
+               else if (item instanceof PriorityHeaderItem)
+               {
+                       itemToBeRendered = new PriorityHeaderItem(bundle);
+               }
+               else
+               {
+                       itemToBeRendered = bundle;
+               }
+               return itemToBeRendered;
        }

                
> Dependencies of Resource Bundle References are ignored
> ------------------------------------------------------
>
>                 Key: WICKET-5291
>                 URL: https://issues.apache.org/jira/browse/WICKET-5291
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.9.1
>            Reporter: Tobias Haupt
>            Assignee: Emond Papegaaij
>             Fix For: 7.0.0, 6.10.0
>
>         Attachments: quickstart_bundle.zip
>
>
> When several resource references are bundled, the bundle inherits the 
> dependencies of all included resource references. Those dependencies are not 
> evaluated when a header item is created from an included reference and 
> rendered to the response (in ResourceAggregator). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to