prabhuish / webutilities

Automatically exported from code.google.com/p/webutilities
0 stars 0 forks source link

java.lang.StringIndexOutOfBoundsException when combining JS using maven artifact #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Add webutilities as a maven dependency
2.  Attempt to combine some JS
3.  Note error 

What is the expected output? What do you see instead?
 The expected output should be combined JS files.  Instead you get a HTTP 500.

What version of the product are you using? On what operating system?
 0.0.5 on MacOS X 

Please provide any additional information below.
I get the following when attempting to use the maven artifact and compress JS 
files:

java.lang.StringIndexOutOfBoundsException: String index out of range: 102891
    java.lang.String.substring(String.java:1934)
    com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:267)
    com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:330)
    com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
    com.googlecode.webutilities.filters.YUIMinFilter.doFilter(YUIMinFilter.java:179)
    com.googlecode.webutilities.filters.CompressionFilter.doFilter(CompressionFilter.java:112)
    com.googlecode.webutilities.filters.ResponseCacheFilter.doFilter(ResponseCacheFilter.java:241)

Apparently there is a conflict between the rhino jar and the yuicompressor jar, 
they both contain org/mozilla/javascript/Parser.

See also:

http://yuilibrary.com/forum/viewtopic.php?p=20086
http://stackoverflow.com/questions/6652550/yui-compressor-stringindexoutofbounds
exception-on-jboss

Original issue reported on code.google.com by walden.r...@gmail.com on 10 Nov 2011 at 9:43

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
yuicompressor-2.4.6.jar
js-1.6R7.jar (rhino)
webutilities-0.0.5.jar

Original comment by walden.r...@gmail.com on 10 Nov 2011 at 9:55

GoogleCodeExporter commented 9 years ago
I think there is known issue with YUICompressor when used with maven. 
yuicompressor.jar and rhino.jar are somehow mismatched causing this issue.

http://yuilibrary.com/projects/yuicompressor/ticket/2528114

Original comment by rr.patil...@gmail.com on 11 Nov 2011 at 3:57

GoogleCodeExporter commented 9 years ago
Temporary solution would be to bundle, package yuicompressor your self and use 
directly in the project without specifying it as maven dependency. 

Original comment by rr.patil...@gmail.com on 11 Nov 2011 at 3:58

GoogleCodeExporter commented 9 years ago
Thanks, I found that yui ticket right after I filed this one, feel free to 
close as invalid/wontfix.

Original comment by walden.r...@gmail.com on 11 Nov 2011 at 4:00

GoogleCodeExporter commented 9 years ago
P.S.  I hope I didn't waste too much of your time!  Keep up the good work!

Original comment by walden.r...@gmail.com on 11 Nov 2011 at 4:17

GoogleCodeExporter commented 9 years ago
Thanks Walden. I think the fix for this is actually at YUI side. They need to 
fix their dependency bundling/fetching.

For the time being fix would be to include those jars yourself as I suggested 
earlier. Closing this for now.

Original comment by rr.patil...@gmail.com on 8 Dec 2011 at 6:12