I had a problem when the YUI Compressor works fine in my IDE and even when I deploy tomcat using the maven tomcat:run
target but throw a StringIndexOutOfBoundsException when launching the application as a WAR file:
java.lang.StringIndexOutOfBoundsException: String index out of range: 412 at java.lang.String.substring(String.java:1934) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:267) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:330) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
Now I know that many people have reported this problem, for example below: Yui Compressor StringIndexOutOfBoundsException on jboss
You can find other people who are mentioned elsewhere on the Internet.
It has been suggested that you need to link the rhino files with the yui compressor in the same bank in order to avoid a class path error.
I looked further, and I realized that Yahoo has released version 2.4.7, which does this. Therefore, I included this new version in my project and made sure that I delete other banks, and I still get the same error.
How to fix it?
source share