changcheng / wro4j

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

IndexOutOfBoundsException with YUIJsCompressorProcessor upon 1.4.6 upgrade. #457

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. If I upgrade the wro4j-maven-plugin from 1.4.5 to 1.4.6 I get the stack 
track below for all JS resources when invoking the run goal.  It works fine if 
I switch back to 1.4.5.

What is the expected output? What do you see instead?

2365 WARN YUIJsCompressorProcessor - Exception while applying 
YUIJsCompressorProcessor processor on the  resource, no processing applied...
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.getToken(JavaScriptCompressor.java:595)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSymbolTree(JavaScriptCompressor.java:1113)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.compress(JavaScriptCompressor.java:573)
    at ro.isdc.wro.extensions.processor.js.YUIJsCompressorProcessor.process(YUIJsCompressorProcessor.java:122)
    at ro.isdc.wro.model.resource.processor.impl.LazyProcessorDecorator.process(LazyProcessorDecorator.java:37)
    at ro.isdc.wro.model.resource.processor.support.ProcessorDecorator.process(ProcessorDecorator.java:84)
    at ro.isdc.wro.model.resource.processor.support.AbstractProcessorDecoratorSupport.process(AbstractProcessorDecoratorSupport.java:118)
    at ro.isdc.wro.model.group.processor.GroupsProcessor$1.process(GroupsProcessor.java:141)
    at ro.isdc.wro.model.group.processor.GroupsProcessor.applyPostProcessors(GroupsProcessor.java:120)
    at ro.isdc.wro.model.group.processor.GroupsProcessor.doPostProcess(GroupsProcessor.java:96)
    at ro.isdc.wro.model.group.processor.GroupsProcessor.process(GroupsProcessor.java:75)
    at ro.isdc.wro.cache.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:40)
    at ro.isdc.wro.cache.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:22)
    at ro.isdc.wro.cache.AbstractSynchronizedCacheStrategyDecorator.get(AbstractSynchronizedCacheStrategyDecorator.java:52)
    at ro.isdc.wro.manager.WroManager.serveProcessedBundle(WroManager.java:182)
    at ro.isdc.wro.manager.WroManager.process(WroManager.java:134)
    at ro.isdc.wro.maven.plugin.Wro4jMojo.processGroup(Wro4jMojo.java:212)
    at ro.isdc.wro.maven.plugin.Wro4jMojo.doExecute(Wro4jMojo.java:117)
    at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.execute(AbstractWro4jMojo.java:106)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

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

1.4.6.  OS X.

Please provide any additional information below.

POM snippet (group and resource names changed to protect the innocent):

<plugin>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>
    <version>1.4.6</version>
    <executions>
        <execution>
            <id>optimize-resources</id>
            <phase>process-resources</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <targetGroups>groupA,groupB,[...]</targetGroups>
        <contextFolder>${basedir}/src/main</contextFolder>
        <destinationFolder>${project.build.directory}/${project.build.finalName}</destinationFolder>
        <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/static/css</cssDestinationFolder>
        <jsDestinationFolder>${wro.jsDestinationFolder}</jsDestinationFolder>
        <ignoreMissingResources>false</ignoreMissingResources>
        <wroFile>${basedir}/wro.xml</wroFile>
        <extraConfigFile>${basedir}/wro.properties</extraConfigFile>
        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
    </configuration>
</plugin>

wro.properties:

managerFactoryClassName=ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWro
ManagerFactory
preProcessors=cssImport,lessCss
postProcessors=yuiCssMin,yuiJsMin

wro.xml:

<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro">
    <group name="groupA">
        <css>/less/groupA.less</css>
        <js>/js/groupA.js</js>
        <js>/js/groupA-1.js</js>
    </group>
    <group name="groupB">
        <js>/js/groupB-1.js</js>
        <js>/js/groupB-2.js</js>
        [...]
    </group>
    [...]
</groups>

Original issue reported on code.google.com by i...@ianbrandt.com on 7 Jun 2012 at 9:51

GoogleCodeExporter commented 9 years ago
The YuiJS processor is broken in 1.4.7. I'll update the "knownIssues" wiki 
page. 
The problem is that YUI require older version of Rhino. There is an open issue 
on YUI for migrating to Rhino 1.7R3, but it doesn't seem to be a priority for 
them.

I would recommend to use a different minifier, there are plenty of alternatives.

Original comment by alex.obj...@gmail.com on 7 Jun 2012 at 9:57

GoogleCodeExporter commented 9 years ago
Thanks for the quick reply.  I'll keep an eye on 
http://yuilibrary.com/projects/yuicompressor/ticket/2528056 and  
https://github.com/yui/yuicompressor/pull/9, and otherwise switch to a 
different compressor.

Original comment by i...@ianbrandt.com on 8 Jun 2012 at 9:50

GoogleCodeExporter commented 9 years ago
Also, thanks for documenting it at 
http://code.google.com/p/wro4j/wiki/KnownIssues.

Original comment by i...@ianbrandt.com on 8 Jun 2012 at 9:52

GoogleCodeExporter commented 9 years ago
The YuiJsCompressorProcessor is deprecated and was removed from latest version 
because of discontinued support and incompatibility with latest version of 
rhino. Closing this issue with WontFix resolution.

Original comment by alex.obj...@gmail.com on 1 Dec 2012 at 10:26