yui / yuicompressor

YUI Compressor
http://yui.github.com/yuicompressor/
Other
3.01k stars 662 forks source link

java.lang.StringIndexOutOfBoundsException: String index out of range #323

Open bitcompiler opened 5 years ago

bitcompiler commented 5 years ago

The below code produce an error

java.lang.StringIndexOutOfBoundsException: String index out of range

HtmlCompressor compressor = new HtmlCompressor();

compressor.setEnabled(true); //if false all compression is off (default is true) compressor.setRemoveComments(true); //if false keeps HTML comments (default is true) compressor.setRemoveMultiSpaces(true); //if false keeps multiple whitespace characters (default is true) compressor.setRemoveIntertagSpaces(true);//removes iter-tag whitespace characters compressor.setRemoveQuotes(true); //removes unnecessary tag attribute quotes compressor.setCompressCss(true); //compress css using Yahoo YUI Compressor compressor.setCompressJavaScript(true); //compress js using Yahoo YUI Compressor compressor.setYuiCssLineBreak(80); //--line-break param for Yahoo YUI Compressor compressor.setYuiJsDisableOptimizations(true); //--disable-optimizations param for Yahoo YUI Compressor compressor.setYuiJsLineBreak(-1); //--line-break param for Yahoo YUI Compressor compressor.setYuiJsNoMunge(true); //--nomunge param for Yahoo YUI Compressor compressor.setYuiJsPreserveAllSemiColons(true);//--preserve-semi param for Yahoo YUI Compressor

String str = "<html><body><p>Hover over the checkbox to simulate a mouse-click.</p><form><input type=\"checkbox\" id=\"myCheck\" onmouseover=\"myFunction()\" onclick=\"alert('click event occured')\"></form><script>function myFunction(){document.getElementById(\"myCheck\").click();}</script></body></html>"; System.out.println(compressor.compress(str));

If remove the Githubissues.

  • Githubissues is a development platform for aggregating issues.