seancoyne / farcryless

A LESS compiler for FarCry
Other
2 stars 0 forks source link

Support for Java 8 #4

Open webonix opened 8 years ago

webonix commented 8 years ago

I am running Lucee on 1.8.0_51 (Oracle Corporation) 64bit and run into array out of bounds issue. Hopefully this is enough for you to review for yourself

farcry/plugins/farcryless/packages/custom/less.cfc

    private any function getJavaLoader() {
        if (!structKeyExists(application.stPlugins["farcryless"],"javaloader")) {
            var paths = [

// Java 8
// https://github.com/mozilla/rhino/releases/
//  1.7.7 https://github.com/mozilla/rhino/releases/download/Rhino1_7_7_RELEASE/rhino1.7.7.zip

// http://grepcode.com/project/repo1.maven.org/maven2/com.asual.lesscss/lesscss-engine/
// 1.5.1  http://grepcode.com/snapshot/repo1.maven.org/maven2/com.asual.lesscss/lesscss-engine/1.5.1/

                expandPath('/farcry/plugins/farcryless/packages/custom/lib/lesscss-engine-1.5.1.jar'),
                // AJM expandPath('/farcry/plugins/farcryless/packages/custom/lib/lesscss-engine-1.3.3.jar'),
                // AJM expandPath('/farcry/plugins/farcryless/packages/custom/lib/lesscss-engine-1.3.1.jar'),
                expandPath('/farcry/plugins/farcryless/packages/custom/lib/js.jar')
            ];
            application.stPlugins["farcryless"].javaloader = createObject("component","farcry.core.packages.farcry.javaloader.JavaLoader").init(
                loadPaths = paths,
                loadColdFusionClassPath = true
            );
        }
        return application.stPlugins["farcryless"].javaloader;
    }
seancoyne commented 8 years ago

i dont suppose you have a Vagrantfile handy for your environment where you can reproduce this?

webonix commented 8 years ago

no - sorry I can send you my less files if that would help?

seancoyne commented 8 years ago

do you get the same error w/ something like Bootstrap?

webonix commented 8 years ago

I can reproduce with

<less:registerLess id="bootstrapResponsive"
                   baseHref="#expandPath('/farcry/plugins/skinPSL1/www/lib/bootstrap-2.3.0/less')#"
                   lFiles="responsive.less"
                   />

com.asual.lesscss.LessException: java.lang.ArrayIndexOutOfBoundsException: 19567

I was also able to resolve by just updating to Rhino JS version 1.7.7 leaving lesscss-engine-1.3.3.jar

seancoyne commented 8 years ago

So I dont think this is a Java 8 problem. It does seem to be a problem w/ newer versions of Bootstrap and potentially other files that use certain LESS syntax that the lesscss-engine library or Rhino cannot handle. I have a test environment setup with Lucee running on Java 8 and all the unit tests pass just fine using Bootstrap 2.0.2, so Java 8 itself is not the problem.

That said, upgrading to BS 2.3.2 causes the tests to fail. So something about the newer LESS files is breaking it.

I'm going to try upgrading Rhino and/or lesscss-engine and see if I can get it working with newer versions.

seancoyne commented 8 years ago

Hmmm... strike that. I was able to get BS 2.3.2 to compile w/o having to upgrade anything.

Can you try the upgrades branch I just pushed up in your environment and run the unit tests? You'll need the testMXUnit plugin then you can run them from the webtop.

Have you tried BS 2.3.2 instead of 2.3.0?

I suppose I can try to find a copy of 2.3.0 and see if I get the same error...