press icon indicating copy to clipboard operation
press copied to clipboard

Exception on file compression

Open rsilve opened this issue 14 years ago • 10 comments

Hi

I try to use press module 1.0.25 in play 1.2.4 For all js file I get the same exception

Oops: StringIndexOutOfBoundsException An unexpected error occured caused by exception StringIndexOutOfBoundsException: String index out of range: 211

play.exceptions.UnexpectedException: Unexpected Error at press.Compressor.writeCompressedFile(Compressor.java:352) at press.Compressor.getCompressedFile(Compressor.java:323) at press.Compressor.getCompressedFile(Compressor.java:291) at press.JSCompressor.getCompressedFile(JSCompressor.java:32) at controllers.press.Press.getCompressedJS(Press.java:25) at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502) at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478) at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161) at Invocation.HTTP Request(Play!) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 211 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.(JavaScriptCompressor.java:533) at press.JSCompressor$1.compress(JSCompressor.java:46) at press.Compressor.compress(Compressor.java:407) at press.Compressor.writeCompressedFile(Compressor.java:345) ... 10 more

After this an empty file is generate in the cache

Any ideas ?

Thanks

Robert

rsilve avatar Dec 24 '11 06:12 rsilve

Hmm I haven't seen that before. It looks like it's coming out of the YUI Compressor itself. Does this sound similar to the problem you're seeing?: http://stackoverflow.com/questions/8429095/yui-compressor-throws-stringindexoutofboundsexception-when-running-in-tomcat-fro http://yuilibrary.com/forum/viewtopic.php?p=28719 http://yuilibrary.com/projects/yuicompressor/ticket/2528114

dirkmc avatar Dec 24 '11 07:12 dirkmc

Hi

It's difficult to say but It sound similar.

I will make some other tests with a very minimal project.

Thank's for your help

Robert

Le 24 déc. 2011 à 08:43, dirkmc a écrit :

Hmm I haven't see n that before. It looks like it's coming out of the YUI Compressor itself. Does this sound similar to the problem you're seeing?: http://stackoverflow.com/questions/8429095/yui-compressor-throws-stringindexoutofboundsexception-when-running-in-tomcat-fro http://yuilibrary.com/forum/viewtopic.php?p=28719 http://yuilibrary.com/projects/yuicompressor/ticket/2528114


Reply to this email directly or view it on GitHub: https://github.com/dirkmc/press/issues/23#issuecomment-3266917

rsilve avatar Dec 24 '11 10:12 rsilve

It seems that it is related to the use of less module ...

I send you a minimal project that send the exception if you want to go deep in this problem

run with play run --%prod

Robert

Le 24 dc. 2011 08:43, dirkmc a crit :

Hmm I haven't seen that before. It looks like it's coming out of the YUI Compressor itself. Does this sound similar to the problem you're seeing?: http://stackoverflow.com/questions/8429095/yui-compressor-throws-stringindexoutofboundsexception-when-running-in-tomcat-fro http://yuilibrary.com/forum/viewtopic.php?p=28719 http://yuilibrary.com/projects/yuicompressor/ticket/2528114


Reply to this email directly or view it on GitHub: https://github.com/dirkmc/press/issues/23#issuecomment-3266917

rsilve avatar Dec 24 '11 10:12 rsilve

Thanks for taking the time to look into this bug. Are you saying that when you create a project that has both press and less you get this error occurring? In the mean time you can try the greensript module, it supports less.

dirkmc avatar Dec 24 '11 10:12 dirkmc

For me the bug occured when press AND less are used together.

For now I have try greenscript but for a reason I don't understand for now, it don't do the less process.

My purpose is to test play and in my test less is more important than compress. So for now i will continue my tests an keep compression for later tests.

If perhaps you need testing let me know.

thanks for all

Robert

Le 24 déc. 2011 à 11:49, dirkmc a écrit :

Thanks for taking the time to look into this bug. Are you saying that when you create a project that has both press and less you get this error occurring? In the mean time you can try the greensript module, it supports less.


Reply to this email directly or view it on GitHub: https://github.com/dirkmc/press/issues/23#issuecomment-3267352

rsilve avatar Dec 24 '11 11:12 rsilve

Damn that sucks, I'm sorry you've had a poor experience with these plugins. I'm planning to integrate less compression into press very soon (in the next couple of weeks), I'll comment on this issue when it's ready.

dirkmc avatar Dec 24 '11 11:12 dirkmc

That cool :)

I stay tuned

Thanks :)

Le 24 déc. 2011 à 12:10, dirkmc a écrit :

Damn that sucks, I'm sorry you've had a poor experience with these plugins. I'm planning to integrate less compression into press very soon (in the next couple of weeks), I'll comment on this issue when it's ready.


Reply to this email directly or view it on GitHub: https://github.com/dirkmc/press/issues/23#issuecomment-3267404

rsilve avatar Dec 24 '11 11:12 rsilve

Hi

I'm not using the less module but also seeing this error. My stack trace looks like:

@69271338k Internal Server Error (500) for request GET /press/css/XQIwMzoHwADZCfRDKAPiSAJJ.css

Oops: StringIndexOutOfBoundsException An unexpected error occured caused by exception StringIndexOutOfBoundsException: String index out of range: 5636

play.exceptions.UnexpectedException: Unexpected Error at press.Compressor.writeCompressedFile(Compressor.java:352) at press.Compressor.getCompressedFile(Compressor.java:323) at press.Compressor.getCompressedFile(Compressor.java:291) at press.CSSCompressor.getCompressedFile(CSSCompressor.java:28) at controllers.press.Press.getCompressedCSS(Press.java:32) at play.utils.Java.invokeStatic(Java.java:129) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:139) at Invocation.HTTP Request(Play!) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 5636 at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:879) at java.lang.StringBuffer.substring(StringBuffer.java:416) at com.yahoo.platform.yui.compressor.CssCompressor.compress(CssCompressor.java:125) at press.CSSCompressor$1.compress(CSSCompressor.java:42) at press.Compressor.compress(Compressor.java:407) at press.Compressor.writeCompressedFile(Compressor.java:345) ... 7 more

dabeeeenster avatar Jan 07 '12 15:01 dabeeeenster

Thanks for the bug report. Did you check the links I listed above to see if they might be related to your problem?

dirkmc avatar Jan 08 '12 13:01 dirkmc

That does look like the same error as me, but I don't have rhino in any other jars in my project. Is there any way I can provide some sort of test for you to work with? My project is not open source I'm afraid.

dabeeeenster avatar Jan 08 '12 16:01 dabeeeenster