While executing this script:
function main() { let content = Repository.query("//element(*, ametys:content)").stream().findFirst().orElse(null); Ametys.console.info("[BEGIN] " + content); Content.save(content); Ametys.console.info("[END] " + content);
I get this output:
[INFO] [BEGIN] '/ametys:contents/psychologie-sociale-du-travail-et-des-organisations' (content://cdfea03e-6782-410c-bb9c-45b4409dc844) org.graalvm.polyglot.PolyglotException at org.ametys.cms.workflow.EditContentFunction.execute(EditContentFunction.java:221) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.ametys.runtime.plugin.component.PluginsComponentManager$ComponentInvocationHandler.invoke(PluginsComponentManager.java:198) at com.sun.proxy.$Proxy28.execute(Unknown Source) at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:871) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1044) at org.ametys.plugins.workflow.AbstractAmetysWorkflow.transitionWorkflow(AbstractAmetysWorkflow.java:212) at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:567) at org.ametys.plugins.workflow.AbstractAmetysWorkflow.doAction(AbstractAmetysWorkflow.java:164) at org.ametys.cms.workflow.ContentWorkflowHelper.doAction(ContentWorkflowHelper.java:340) at doWorkflowAction(generated script:600:20185-20241) at save(generated script:1361:45530-45589) at main(generated script:6:240-260) at :program(generated script:1874:65135-65140) at org.graalvm.polyglot.Context.eval(Context.java:353) at org.ametys.plugins.core.ui.script.ScriptHandler._executeScript(ScriptHandler.java:210) at org.ametys.plugins.core.ui.script.ScriptHandler.executeScript(ScriptHandler.java:147) at org.ametys.plugins.core.impl.schedule.ScriptSchedulable._executeScript(ScriptSchedulable.java:87) at org.ametys.plugins.core.impl.schedule.ScriptSchedulable.execute(ScriptSchedulable.java:81) at org.ametys.core.schedule.AmetysJob.execute(AmetysJob.java:151) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
It's very useful to be able to save content in asynchronous mode for very long processes to execute.
In synchronous mode, everything is OK.
- Est dupliqué par
-
CMS-11013 EditContentFunction called without context parameters can throw NPE
- Closed