[ 
https://issues.apache.org/jira/browse/WICKET-6611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Heigl updated WICKET-6611:
---------------------------------
    Summary: Missing check for IScopeAwareTextResourceProcessor when 
concatenating resources  (was: Missing check for 
IScopeAwareTextResourceProcessor for concatenated resources)

> 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