macray / htmlcompressor

Automatically exported from code.google.com/p/htmlcompressor
Apache License 2.0
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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(HtmlCompres
sor.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

Original issue reported on code.google.com by joesiegr...@gmail.com on 20 Sep 2009 at 4:54

GoogleCodeExporter commented 9 years ago
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:
{{{
<pre>
    <script>
        s = "</pre>";
    </script>
    This part will be compressed by mistake.
</pre>
}}}

Original comment by serg472@gmail.com on 23 Sep 2009 at 5:10