Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 6 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

javauser

  • Username: javauser
  • Joined: Fri Apr 16, 2010 4:13 pm
  • Posts: 1
  • Offline
  • Profile

YUI compressor 2.4.2 works in Java app but not in web app

Post Posted: Fri Apr 16, 2010 4:22 pm
+0-
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!

Rajendra Patil

  • Username: rrpatil26
  • Joined: Thu May 20, 2010 1:51 am
  • Posts: 2
  • Offline
  • Profile

Re: YUI compressor 2.4.2 works in Java app but not in web ap

Post Posted: Thu May 20, 2010 2:27 am
+0-
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.

mihxil

  • Joined: Wed Dec 15, 2010 7:39 am
  • Posts: 2
  • Offline
  • Profile
Tags:
  • yuicompressor

Re: YUI compressor 2.4.2 works in Java app but not in web ap

Post Posted: Wed Dec 15, 2010 7:44 am
+0-
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.

mihxil

  • Joined: Wed Dec 15, 2010 7:39 am
  • Posts: 2
  • Offline
  • Profile
Tags:
  • yuicompressor

Re: YUI compressor 2.4.2 works in Java app but not in web ap

Post Posted: Wed Dec 15, 2010 8:34 am
+0-
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.

Walden

  • Username: Walden
  • Joined: Thu Nov 10, 2011 2:08 pm
  • Posts: 2
  • Offline
  • Profile
Tags:
  • app

Re: YUI compressor 2.4.2 works in Java app but not in web ap

Post Posted: Thu Nov 10, 2011 2:12 pm
+0-
This is also the case with 2.4.6, is this something that will be fixed or should I package YUI + rhino together myself?

Walden

  • Username: Walden
  • Joined: Thu Nov 10, 2011 2:08 pm
  • Posts: 2
  • Offline
  • Profile
Tags:
  • app
  • ticket
  • yuicompressor

Re: YUI compressor 2.4.2 works in Java app but not in web ap

Post Posted: Thu Nov 10, 2011 2:20 pm
+0-
See also http://yuilibrary.com/projects/yuicompr ... et/2528114
  [ 6 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
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