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

Thomas Heigl commented on WICKET-6611:
--------------------------------------

[~klopfdreh] thanks for your detailed response!

For now, I resolved this by overriding {{CssUrlReplacer.compress}} and 
returning the original input string instead of failing with an exception.

This works for me, but other users could run into these issues as well.  I'm 
unsure how we can improve this given the circumstances you mentioned.

> Missing check for IScopeAwareTextResourceProcessor when concatenating 
> resources
> -------------------------------------------------------------------------------
>
>                 Key: WICKET-6611
>                 URL: https://issues.apache.org/jira/browse/WICKET-6611
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.1.0
>            Reporter: Thomas Heigl
>            Priority: Major
>
> Resource concatenation cannot be used with text compressors relying on scope 
> information.
> I tried to use {{CssUrlReplacer}} in my application and it failed on startup 
> with an {{UnsupportedOperationException}} in the {{compress}} method.
> In {{CssPackageResource}} we have the following code:  
> {code:java}
> ICssCompressor compressor = getCompressor();
> if (compressor != null && getCompress())
> {
>    try
>    {
>       String charsetName = "UTF-8";
>       String nonCompressed = new String(processedResponse, charsetName);
>       String output;
>       if (compressor instanceof IScopeAwareTextResourceProcessor)
>       {
>          IScopeAwareTextResourceProcessor scopeAwareProcessor = 
> (IScopeAwareTextResourceProcessor) compressor;
>          output = scopeAwareProcessor.process(nonCompressed, getScope(), 
> name);
>       }
>       else
>       {
>          output = compressor.compress(nonCompressed);
>       }
>       return output.getBytes(charsetName);
>    }
>    catch (Exception e)
>    {
>       log.error("Error while filtering content", e);
>       return processedResponse;
>    }
> }{code}
> In {{ConcatBundleResource}} this {{instanceof}} is missing and {{compress}} 
> is called directly.
> {code:java}
> if (getCompressor() != null)
> {
>    String nonCompressed = new String(bytes, "UTF-8");
>    bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8");
> }{code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to