Open thadguidry opened 4 months ago
Yes, you are indeed not registering any expression language in https://github.com/thadguidry/refine-groovy/blob/master/module/MOD-INF/controller.js
Compare this to https://github.com/wetneb/refine-js/blob/master/module/MOD-INF/controller.js
OK, now it registers, but
@wetneb Hmm, where did things go wrong? Before when bundled, I had this for controller.js : https://github.com/thadguidry/OpenRefine/commit/89858092d98b29ed78fa55e5243e0ef001d15706
Now, have this:
// Register a new language parser for Groovy
Packages.com.google.refine.expr.MetaParser.registerLanguageParser(
"groovy",
"Groovy",
Packages.io.github.thadguidry.refinegroovy.GroovyEvaluable.createParser(),
"value"
);
which now as shown below cannot access the method but it could before when bundled?
Initializing refine-groovy extension
refine-groovy mount point is /extension/refine-groovy/ [*]
01:04:23.420 [ butterfly.module] Error initializing module refine-groovy by script function init() (924ms)
org.mozilla.javascript.EcmaError: TypeError: Cannot call property createParser in object [JavaPackage io.github.thadguidry.refinegroovy.GroovyEvaluable]. It is not a function, it is "object". (file:/F:/Downloads/openrefine-win-with-java-3.8.1/openrefine-3.8.1/webapp/extensions/refine-groovy/module/MOD-INF/controller.js#47)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4563)
I built this extension and unzipped it in my workspace extensions directory for the current development build and it seemed to work fine, showing up in the Transform dialog's menu and accepting and processing Groovy syntax.
Well son of a gun. Thanks @tfmorris it must have been my environment. I will go back and test as well.
@tfmorris Any idea why I get the following error when I use the built version from the GitHub CI and download that latest published release, install it into my workspace /extensions
folder - but you don't see the same? Can you try the release .zip package and see if you get this same error?
10:12:34.582 [ refine] C:\Users\thadg\AppData\Roaming\OpenRefine (0ms)
Initializing refine-groovy extension
refine-groovy mount point is /extension/refine-groovy/ [*]
10:12:40.753 [ butterfly.module] Error initializing module refine-groovy by script function init() (6170ms)
org.mozilla.javascript.EcmaError: TypeError: Cannot call property createParser in object [JavaPackage io.github.thadguidry.refinegroovy.GroovyEvaluable]. It is not a function, it is "object". (file:/C:/Users/thadg/AppData/Roaming/OpenRefine/extensions/refine-groovy/module/MOD-INF/controller.js#47)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4563)
It would be very helpful to me if you could include versions when describing problems. It's not clear to me what version of the extension or of OpenRefine you're testing.
I tested refine-groovy 1.3.0, the latest of the three releases that I saw. It works with the latest HEAD from the master branch, but doesn't appear to work with OpenRefine 3.8.0, the latest release version that I have on my system. I didn't look into why.
Antonin did refactor the language parsers recently, but, as far as I remember, it shouldn't have affected this.
@tfmorris You are absolutely right and I should know better. I am testing the refine-groovy 1.3.0 release against my workspace /extensions
folder using OpenRefine 3.8.2
@wetneb
I saw you made changes back in May ? https://github.com/OpenRefine/OpenRefine/pull/6502/files#diff-9c4677e55f6d34132f59afd27a1fd441fee454664615482b7a6d1ba44f15d8d1R335
I get this error as mentioned in previous comments above:
org.mozilla.javascript.EcmaError: TypeError: Cannot call property createParser in object [JavaPackage io.github.thadguidry.refinegroovy.GroovyEvaluable]. It is not a function, it is "object".
Yet our documentation about Scripting Languages says:
The third is an object that implements the interface com.google.refine.expr.LanguageSpecificParser.
So I have indeed put that object (not a function as the error states) there in third position: https://github.com/thadguidry/refine-groovy/blob/495eab1354fc3e36d078adfefd79dcbaa7a77379/module/MOD-INF/controller.js#L46-L52
And my code below does implement that interface, no? It return new LanguageSpecificParser()
as seen on https://github.com/thadguidry/refine-groovy/blob/495eab1354fc3e36d078adfefd79dcbaa7a77379/src/main/java/io/github/thadguidry/refinegroovy/GroovyEvaluable.java#L23-L29
I don't notice any obvious error. Generally this sort of error happens whenever the class / method cannot be found, so you might have packaging issues / name discrepancies or other things like that.
@ wetneb Looks like it is something with release 3.8.2?
/extensions
folder), then it works and inits that packaged refine-groovy without error!/extensions
folder), then I get that error.So...hmm, it's a bug in 3.8.2 that is now resolved, I guess?
Let me try it with latest OpenRefine snapshot just to see.
On Sun, Sep 22, 2024 at 8:33 PM Thad Guidry @.***> wrote:
So...hmm, it's a bug in 3.8.2 that is now resolved, I guess?
I suspect it's actually something to do with the packaging, as suggested by Antonin, but I'm not sure what.
Although it failed to work with the 3.8.0 binary distribution, when I checked out sources from the 3.8.0 tag, built and ran OpenRefine, the Groovy extension worked fine. This suggests to me that it's not a problem with the code, but some quirk of the packaging.
Tom
Message ID: @.***>
@tfmorris of my refine-groovy packaging? or OpenRefine's Windows release package?
On Sun, Sep 22, 2024 at 8:51 PM Thad Guidry @.***> wrote:
@tfmorris https://github.com/tfmorris of my refine-groovy packaging? or OpenRefine's Windows release package?
OpenRefine's release packaging on Windows & Mac. I used the same refine-groovy zip file for all tests, with varying results.
@wetneb do you have any idea what might be wrong or going on?