[ 13 posts ] Go to page 1, 2 Next

mattkime

  • Joined: Tue Jan 27, 2009 11:46 am
  • Posts: 1
  • Offline
  • Profile
Tags:

yui compressor 2.4.2 problems

Post Posted: Tue Jan 27, 2009 2:18 pm
+0-
pardon the repost from the ydn-javascript list. seems that compressor discussion should go here from now on.
---
i'm using yui compressor with the packtag jsp tag. v2.4 works fine but
newer versions fail. the basic test case i'm working with is the
firebugx.js file -

if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error", "assert",
"dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile",
"profileEnd"];

window.console = {};
for (var i = 0; i < names.length; ++i){
window.console[names[i]] = function() {}; }
};

all versions compress successfully from the command line. v2.4.2
produces the following stack trace when run with packtag -

[2009/01/27 13:47:46.084] Caused by: javax.servlet.jsp.JspTagException:
java.lang.StringIndexOutOfBoundsException: String index out of range:
375
[2009/01/27 13:47:46.084] at
net.sf.packtag.tag.BaseTag.promoteError(BaseTag.java:328)
[2009/01/27 13:47:46.084] at
net.sf.packtag.tag.PackTag.doEndTag(PackTag.java:107)
[2009/01/27 13:47:46.084] at
_jsp._WEB_22dINF._jsp._inc._footer__jsp._jspService(_footer__jsp.java:10\
5)
[2009/01/27 13:47:46.084] ... 48 more

---

i've tried stepping through the code but i'm still unsure if this is a
packtag problem or a yui problem.

any advice?

commonbullet

  • Username: common
  • Joined: Tue Sep 08, 2009 8:10 pm
  • Posts: 1
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Tue Sep 08, 2009 8:15 pm
+0-
I'm having similar problems with version 2.4.2.

Any work around? Where can I download version 2.4?

Thanks.

EDIT: Actually the problem (java.lang.StringIndexOutOfBoundsException) takes place when the compressor is started by Netbeans IDE, the compiled version works ok through console - I must be missing some configuration.

jchernia

  • Joined: Tue Nov 17, 2009 2:44 pm
  • Posts: 2
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Tue Nov 17, 2009 2:45 pm
+0-
The YUI compressor uses a modified version of the Rhino source which it compiles in. If you already have Rhino in your application the compressor will not work without properly setting up your class loaders.

Matt Ball

  • Username: mjball
  • Joined: Tue Jan 19, 2010 12:25 pm
  • Posts: 29
  • GitHub: mjball
  • Gists: mjball
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 2:03 pm
+0-
I have this problem as well. Not using any other version of Rhino. What gives?

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 2:11 pm
+0-
The previous post answered this. You just need to change your class path so that your version of Rhino is before the compressor.

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 2:11 pm
+0-
... (you may not be using rhino directly, but something you are using may be doing so)

Matt Ball

  • Username: mjball
  • Joined: Tue Jan 19, 2010 12:25 pm
  • Posts: 29
  • GitHub: mjball
  • Gists: mjball
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 2:24 pm
+0-
Adam - thanks for the quick reply.
I'm not sure of how to change my class path as you said. I'm trying to implement a YUI Compressor servlet filter in a Java Enterprise webapp, so as far as I understand it, there isn't a single classpath. Is there a way for me to verify the order in which Rhino and YUI Compressor are loading (e.g., something like a simple log statement when each is loaded)?

After looking a little closer at the discussion above, I may actually be having a different StringIndexOfOutBoundsException. They seem to be happening at a String.substring call, line 267 of JavaScriptCompressor.java. For whatever reason, "offset" and/or "offset"+"length" lie outside of the bounds of "source" (double-quotes used to indicate variable names). Any ideas on this?

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 3:27 pm
+0-
It depends on the servlet container -- you might be able to make sense of it by reading this:

http://tomcat.apache.org/tomcat-5.5-doc ... howto.html

Matt Ball

  • Username: mjball
  • Joined: Tue Jan 19, 2010 12:25 pm
  • Posts: 29
  • GitHub: mjball
  • Gists: mjball
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 6:22 pm
+0-
Tomcat is the right guess (well, JBoss Web, but it's all the same).
Both yuicompressor-2.4.2.jar and rhino-1.6R7.jar (along with jargs-1.0.jar, but that should be irrelevant) are in WEB-INF/lib, and I can't find any information on JBoss including another version of Rhino elsewhere.

Since JavaScriptCompressor is dying in the middle of the compression, what are the chances that this particular StringIndexOutOfBoundsException is caused by something other than issues with Rhino? If it would be any help, I can post an example of the input JavaScript and the "source" it excepts on.

Sorry for hijacking this thread. Let me know if I should just start a new one.

jchernia

  • Joined: Tue Nov 17, 2009 2:44 pm
  • Posts: 2
  • Offline
  • Profile

Re: yui compressor 2.4.2 problems

Post Posted: Fri Sep 24, 2010 8:45 pm
+0-
YUI Compressor does not use the stock Rhino 1.6R7 jar. There are mods specifically for compression (eg special kinds of comments). It's 99% the same, but causes this error. One workaround is to recompile the source munging org.mozilla.javascript... to org.yuicompressor.javascript... in the YUI source. The jar you compile will no longer conflict with Rhino 1.6R7 (you'll have 2 copies of a lot of classes).
  [ 13 posts ] Go to page 1, 2 Next
Display posts from previous:  Sort by  
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