[ 
https://issues.apache.org/jira/browse/SLING-8425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16844221#comment-16844221
 ] 

Paul Bjorkstrand commented on SLING-8425:
-----------------------------------------

I found it equally weird. I opened 
[https://github.com/oracle/graal/issues/1310] which I hope will get some 
attention. If I had to guess why it is this way, when they implemented GraalJS, 
instead of modifying Nashorn extensively to remove its reported properties' 
values (extensions, mime types, and names), they "cheated" and null-fill an 
array somewhere in Nashorn at runtime.

I'll try to keep an eye on that ticket for any movement. If I don't hear back 
in a reasonable amount of time (any thoughts of what would be "reasonable" 
would be appreciated), would it make sense to move this forward and protect 
Sling from the choices of JDK implementors? 

> 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
>            Assignee: Radu Cotescu
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to