Export to GitHub

htmlcompressor - issue #2

<textarea> in <script> block causes exceptions probably many similar issues


Posted on Sep 20, 2009 by Massive Horse

What steps will reproduce the problem? 1. Compress a html file with the following in it: <script> var t='<textarea ' + '></textarea>'; </script>

What is the expected output? What do you see instead?

I expect it to do nothing, it instead:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:797) at java.lang.StringBuilder.replace(StringBuilder.java:271) at com.googlecode.htmlcompressor.compressor.HtmlCompressor.returnBlocks(HtmlCompressor.java:163) at com.googlecode.htmlcompressor.compressor.HtmlCompressor.compress(HtmlCompressor.java:107) at cmdlinehtml.main(cmdlinehtml.java:40)

What version of the product are you using? On what operating system?

htmlcompressor-0.7.jar

Please provide any additional information below.

Thanks for htmlcompressor!

Joe

Comment #1

Posted on Sep 23, 2009 by Grumpy Hippo

Fixed in 0.7.1 release. Thanks.

There still might be similar problems (it shouldn't display an error now but might compress or skip not what is expected) as it is impossible to solve such issues completely without creating own html and js parsers. For example: {{{

    
        s = "
"; This part will be compressed by mistake.

}}}

Status: Fixed

Labels:
Type-Defect Priority-Medium