| Page 1 of 1 | [ 6 posts ] |
|
I am using YUI compressor 2.4.2 jar in a Java application to compress some JavaScript files. It works great there. But the same code, I use it in a Java web application, I got a lot of java.lang.StringIndexOutOfBoundsException errors.
Those error all happened like this: java.lang.StringIndexOutOfBoundsException: String index out of range: 232 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) Anyone can shed some lights on this problem? Thanks a lot! |
|
I am not sure why exactly would this error be coming but as an exception says it looks like JSCompressor is trying to read char at offset equals to size of string or string is of zero size.
By the way, how exactly are you using YUI compressor in webapp? Probably this (http://webutilities.googlecode.com/) could be useful. |
|
I'm having the same problem. YUICompressor works fine. From a standalone application, or e.g. also from Jetty. I'm getting the same exception in Tomcat though.
I tried it with webutilities ymin, but actually that is even worse, because it simply swallows everything, probably because the same exception is happening. |
|
I think I figured it out. It is a bug in the yuicompressor pom and a conflict with the rhino jar.
I defined my dependency like this: <dependency> <groupId>com.yahoo.platform.yui</groupId> <artifactId>yuicompressor</artifactId> <version>2.4.2</version> </dependency> This results in 2 jars. js-1.6R7.jar and yuicompressor-2.4.2.jar Both containing org/mozilla/javascript/Parser See also http://www.julienlecomte.net/blog/2008/10/80/ I think it works if you don' t use the maven artifact but install the yuicompressor jar manually, because that one contains all necessary rhino ones and not only the ones which are replaced by yuicompressor. |
|
This is also the case with 2.4.6, is this something that will be fixed or should I package YUI + rhino together myself?
|
| Page 1 of 1 | [ 6 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group