Paul Bjorkstrand created SLING-8425:
---------------------------------------
Summary: NPE in SlingScriptEngineManager when Sling is run on
GraalVM
Key: SLING-8425
URL: https://issues.apache.org/jira/browse/SLING-8425
Project: Sling
Issue Type: Bug
Components: Scripting
Affects Versions: Scripting Core 2.0.54
Environment: OS: Ubuntu 18.04.2 LTS
JVM: OpenJDK GraalVM CE 19.0.0 (build 25.212-b03-jvmci-19-b01, mixed mode)
Reporter: Paul Bjorkstrand
When trying to run Sling Starter 11 on GraalVM, there was an NPE in the
SlingScriptEngineManager when it tried to call
{{internalManager.registerEngineExtension}} inside {{registerAssociations}}.
The problem is that a script engine provided by Graal (Nashorn, in this case)
had {{null}} as an extension value.
I imagine that it is a bug with GraalVM itself (I have not dug further into it
yet), but Sling can be defensive, and not call the method(s) inside
{{registerAssociations}} when it sees a null value for either an extension,
mime type, or name.
Fixing this issue also exposes another issue: the SlingScriptEngineManagerTest
assumes that the JDK it is running on only has a single built-in scripting
engine. In Graal, there could be two (or more) built-in scripting engines. In
my situation, there were two: GraalJS and Nashorn. Even though Nashorn is a
seemingly-broken engine in Graal, it still runs through the registration
process, so the tests need to account for it.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)