Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
8.1.0
-
None
Description
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:
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; } }
In ConcatBundleResource this instanceof is missing and compress is called directly.
if (getCompressor() != null) { String nonCompressed = new String(bytes, "UTF-8"); bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8"); }
Attachments
Issue Links
- duplicates
-
WICKET-6669 CSS Resource Bundling throws exception when used with CssUrlReplacer
- Resolved
- is related to
-
WICKET-5827 Allow to apply multiple Javascript / CSS compressors
- Resolved