google-code-export / wro4j

Automatically exported from code.google.com/p/wro4j
1 stars 1 forks source link

Error while minifying js file with jsMin #640

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. The attached file can't be minified with "jsMin"

What is the expected output? What do you see instead?
There is no exception but only the group is not reachable. (404)

What version of the product are you using? On what operating system?
Using wro4j 1.6.1

Please provide any additional information below.

Original issue reported on code.google.com by noctur...@googlemail.com on 4 Jan 2013 at 12:16

Attachments:

GoogleCodeExporter commented 9 years ago
The 404 is caused by any exception occurred during wro4j processing. The 
exception should be visible in logs. Also, you could try use debug=true 
(development mode) to see the stacktrace instead of 404. Could you post your 
logs here? I'm pretty sure there is something else wrong...

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 12:18

GoogleCodeExporter commented 9 years ago
Thanks for the quick reply. Here is the stack.

Original comment by noctur...@googlemail.com on 4 Jan 2013 at 1:17

Attachments:

GoogleCodeExporter commented 9 years ago
That is weird. Could you provide more details about your configuration?

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 1:20

GoogleCodeExporter commented 9 years ago
Sure, here is my configuration:

    <bean id="webResourceOptimizer" class="ro.isdc.wro.http.ConfigurableWroFilter">
        <property name="properties">
            <value>
                debug=${debugWebResources}
                disableCache=${debugWebResources}
                cacheUpdatePeriod=0
                modelUpdatePeriod=0
                gzipResources=true
                cacheGzippedContent=true
                ignoreMissingResources=false
                jmxEnabled=true
                parallelPreprocessing=true
                mbeanName=ro.isdc.wro.http
                preProcessors=cssUrlRewriting,semicolonAppender,cssMin,jsMin
                postProcessors=
            </value>
        </property>
    </bean>

Original comment by noctur...@googlemail.com on 4 Jan 2013 at 1:22

GoogleCodeExporter commented 9 years ago
So, if you are using something else instead of jsMin there is no error?

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 1:23

GoogleCodeExporter commented 9 years ago
Cannot reproduce the problem locally, but it doesn't mean there is no problem. 
My assumption is that there is some race condition caused by parallel 
processing. 
Could you try to set parallelPreprocessing=false and check if the problem can 
be reproduced?

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 1:37

GoogleCodeExporter commented 9 years ago
Managed to reproduce the jsMin failure (which is not related to the stacktrace 
you've attached). 

I get the following exception:
Caused by: 
ro.isdc.wro.model.resource.processor.support.JSMin$UnterminatedRegExpLiteralExce
ption

which is caused by the following script from fullcalendar.js:

Apparently the JsMin does not like the math expressions which contains new 
lines. 
The solution is to remove new lines from that particular expression or use a 
different javascript minimizer (ex: google closure compiler).

Let me know if you agree and I'll close this issue with WONTFIX resolution & 
will update known issues section with this description.

                                        slotHeight * Math.round(
                                            (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
                                            / opt('slotMinutes')
                                        )

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 1:50

GoogleCodeExporter commented 9 years ago
Yes indeed. parallelPreprocessing=false seems to solve this Inject error 
message, but the server is redirecting to 404 anyway, even if I set the debug 
and the disableCache flag to true. I try to use another js minifier, now.

The only way to get it running is to set minimize=false in the group of the 
wro.xml for the previously attached js file - very strange.

Original comment by noctur...@googlemail.com on 4 Jan 2013 at 1:52

GoogleCodeExporter commented 9 years ago
Here is the minimum version of script causing the problem with jsMin:

Math.round(4
    /3);

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 1:53

GoogleCodeExporter commented 9 years ago
Yes, that fixed the issue. I only put the expression in one line and everything 
seems to be ok now. Great!

Original comment by noctur...@googlemail.com on 4 Jan 2013 at 1:56

GoogleCodeExporter commented 9 years ago
I agree to close this issue with WONTFIX and update the issues section. 

Thanks a lot for your help!

Original comment by noctur...@googlemail.com on 4 Jan 2013 at 2:02

GoogleCodeExporter commented 9 years ago
Ah, one little thing. Is there a way to redirect the Exceptions of the 
Processors to the default log implementation so that I can see it, too. This 
would help a lot in such cases.

Original comment by noctur...@googlemail.com on 4 Jan 2013 at 2:07

GoogleCodeExporter commented 9 years ago
Yes, you can add a logger with DEBUG level to the following class: 
ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorat
or

This one acts as a decorator for all processors and logs anytime there is an 
exception.

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 2:45

GoogleCodeExporter commented 9 years ago
Updated KnownIssues with description of JsMinProcessor issue. 

This issue has a solution, so it won't be fixed.

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 2:50

GoogleCodeExporter commented 9 years ago
FAQ wiki page updated with details about how to get a more verbose logging.

Original comment by alex.obj...@gmail.com on 4 Jan 2013 at 3:15