| Page 1 of 2 | [ 13 posts ] | Go to page 1, 2 Next |
|
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? |
|
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. |
|
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.
|
|
I have this problem as well. Not using any other version of Rhino. What gives?
|
|
The previous post answered this. You just need to change your class path so that your version of Rhino is before the compressor.
|
|
... (you may not be using rhino directly, but something you are using may be doing so)
|
|
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? |
|
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 |
|
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. |
|
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).
|
| Page 1 of 2 | [ 13 posts ] | Go to page 1, 2 Next |
| 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