Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

severe bug in HtmlCompressor:preserveBlocks #26

Closed
GoogleCodeExporter opened this issue Aug 20, 2015 · 1 comment
Closed

severe bug in HtmlCompressor:preserveBlocks #26

GoogleCodeExporter opened this issue Aug 20, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

compress a large jsp page (e.g. 2MBytes) leads to messed up html code with 
%%%COMPRESS~EVENT~1.000%%% to %%%COMPRESS~EVENT~11.687%%% fragments in the ouput

caused by HtmlCompressor:preserveBlocks
calls of java.text.MessageFormat.format("%%%COMPRESS~EVENT~{0}%%%", new 
Object[] {Integer.valueOf(index)})

have to be MessageFormat.format("%%%COMPRESS~EVENT~{0,number,#}%%%", new 
Object[] {Integer.valueOf(index)})

can be reproduced with this sample code

for(int index=995; index< 1005; index++){

    // all COMPRESS~???~ patterns are wrong for i>=1000 (at least in HtmlCompressor.java)
    String bad  = java.text.MessageFormat.format("%%%COMPRESS~EVENT~{0}%%%"         , new Object[] {Integer.valueOf(index)});
    String good = java.text.MessageFormat.format("%%%COMPRESS~EVENT~{0,number,#}%%%", new Object[] {Integer.valueOf(index)});
    System.out.println("bad: "+bad +", good:" +good);
}

with corrected code in HtmlCompressor, html output is good

Original issue reported on code.google.com by m.konic...@gmail.com on 2 Feb 2011 at 8:31

@GoogleCodeExporter
Copy link
Author

Wow, that's something I didn't think about. Thanks for debugging, fixed in 0.9.9

Original comment by serg472@gmail.com on 3 Feb 2011 at 2:08

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant