Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample extension's About page errors #17

Open
tfmorris opened this issue Mar 8, 2024 · 5 comments
Open

Sample extension's About page errors #17

tfmorris opened this issue Mar 8, 2024 · 5 comments

Comments

@tfmorris
Copy link
Member

tfmorris commented Mar 8, 2024

The About page for the sample extension fails to render.

To Reproduce

Steps to reproduce the behavior:

  1. Go to http://127.0.0.1:3333/extension/sample/

Current Results

(From new Butterfly error page for improve readability)

HTTP ERROR 500 Butterfly Error Butterfly caught the following error while processing the request:

URI: | /extension/sample/ -- | -- 500 Butterfly Error Butterfly caught the following error while processing the request: refine org.mozilla.javascript.EcmaError: TypeError: Cannot call property stringArrayLength in object [JavaPackage com.google.refine.sampleExtension.SampleUtil]. It is not a function, it is "object". (file:/Users/tfmorris/git/OpenRefine2/main/webapp/../../extensions/sample/module/MOD-INF/controller.js#75)

Caused by:

org.mozilla.javascript.EcmaError: TypeError: Cannot call property stringArrayLength in object [JavaPackage com.google.refine.sampleExtension.SampleUtil]. It is not a function, it is "object". (file:/Users/tfmorris/git/OpenRefine2/main/webapp/../../extensions/sample/module/MOD-INF/controller.js#75)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4563)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4544)
	at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:4576)
	at org.mozilla.javascript.ScriptRuntime.typeErrorById(ScriptRuntime.java:4581)
	at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:4662)
	at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2585)
	at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2568)
	at org.mozilla.javascript.gen.file__Users_tfmorris_git_OpenRefine2_main_webapp_______extensions_sample_module_MOD_INF_controller_js_18._c_process_2(file:/Users/tfmorris/git/OpenRefine2/main/webapp/../../extensions/sample/module/MOD-INF/controller.js:75)
	at org.mozilla.javascript.gen.file__Users_tfmorris_git_OpenRefine2_main_webapp_______extensions_sample_module_MOD_INF_controller_js_18.call(file:/Users/tfmorris/git/OpenRefine2/main/webapp/../../extensions/sample/module/MOD-INF/controller.js)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:380)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3868)
	at org.mozilla.javascript.gen.file__Users_tfmorris_git_OpenRefine2_main_webapp_______extensions_sample_module_MOD_INF_controller_js_18.call(file:/Users/tfmorris/git/OpenRefine2/main/webapp/../../extensions/sample/module/MOD-INF/controller.js)
	at edu.mit.simile.butterfly.ButterflyModuleImpl$Controller.process(ButterflyModuleImpl.java:399)
	at edu.mit.simile.butterfly.ButterflyModuleImpl$Controller.run(ButterflyModuleImpl.java:377)
	at org.mozilla.javascript.Context.call(Context.java:535)
	at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:472)
	at edu.mit.simile.butterfly.ButterflyModuleImpl.processScript(ButterflyModuleImpl.java:654)
	at edu.mit.simile.butterfly.ButterflyModuleImpl.process(ButterflyModuleImpl.java:427)
	at edu.mit.simile.butterfly.Butterfly.service(Butterfly.java:524)
	at com.google.refine.RefineServlet.service(RefineServlet.java:217)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)

Expected Behavior

Velocity template renders correctly.

Versions

  • OpenRefine: 3.7 and current HEAD of master (not sure how far back it goes)

Additional context

At first glance it looks like perhaps the SampleUtil class isn't getting compiled or packaged in the right place.

@Redeem-Grimm-Satoshi
Copy link

@tfmorris You're right, I guess the com.google.refine.sampleExtension.SampleUtil Java package isn't correctly installed and accessible and stringArrayLength can't be referenced as a function

I think a proposed solution is making sure SampleUtil is getting compiled correctly and it's accessible,

or what do you think?

@wetneb
Copy link
Member

wetneb commented Mar 15, 2024

I'd be in favor of dropping the sample extension altogether. As mentioned in OpenRefine/OpenRefine#2300, the fact that it is hosted in our repository makes it of little use for third parties to develop their extensions outside of OpenRefine's repository. The development environment is quite different when working from another repository. Although we could migrate it to a separate repository indeed, I don't think it will be actively maintained if it doesn't implement things that people actually need.

We could take an existing extension (developed outside of the repository) and turn it into a model extension, following all best practices. I have proposed a GSoC internship on this subject, which also incorporates the feedback from @antoine2711 about the lack of tooling for Java debugging. @tfmorris I have re-centered the proposal on development, away from documentation, to make it more suitable for GSoC.

@wetneb
Copy link
Member

wetneb commented Apr 24, 2024

Change of mind: I think it's still good to drop it from this repo but I actually see some value in having a basic scaffold of extension as another repository. This could use GitHub's Template repository feature. We could enable Dependabot on it to keep it in sync with OpenRefine.

@tfmorris tfmorris transferred this issue from OpenRefine/OpenRefine Jul 30, 2024
@tfmorris
Copy link
Member Author

Not sure if this is still a problem, but transferring the issue from the main repo to the new one for verification.

@tfmorris
Copy link
Member Author

It looks like there is still a problem with this page, but it's changed slightly. As currently configured, the new URL is

http://127.0.0.1:3333/extension/my-sample-extension/

(but should probably change to http://127.0.0.1:3333/extension/openrefine-sample-extension/)

The page doesn't error now, but also doesn't resolve template variables, so it outputs:

Here is someString: $someString, and someInt: $someInt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants