[ https://issues.apache.org/jira/browse/SLING-12519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18011172#comment-18011172 ]
Joerg Hoh commented on SLING-12519: ----------------------------------- [~yuansc] I think that the code in ScriptableBase is not correct (see SLING-12873), and that it is never invoked by multiple threads; that would be an easy fix, because we could just remove the {{synchronized}} statement. > Dangerous instance of double-checked locking used in > wrapper/ScriptableBase.java > -------------------------------------------------------------------------------- > > Key: SLING-12519 > URL: https://issues.apache.org/jira/browse/SLING-12519 > Project: Sling > Issue Type: Improvement > Components: Scripting > Affects Versions: Scripting JavaScript 3.1.4 > Reporter: Scott Yuan > Priority: Major > Attachments: image-2024-12-02-11-52-14-376.png > > > When activating forked stream SonarQube testing, it was discovered that > wrapper/ScriptableBase (line #49) uses an outdated and generally discouraged > pattern known as double-checked locking. This practice is marked as > potentially dangerous, as highlighted by SonarQube's rule S2168. > !image-2024-12-02-11-52-14-376.png! > To resolve this issue, replace the double-checked locking mechanism with > method-level synchronization. This change will enhance the reliability of the > Apache Sling Script JavaScript Support implementation. -- This message was sent by Atlassian Jira (v8.20.10#820010)