vyommani commented on code in PR #872:
URL: https://github.com/apache/ranger/pull/872#discussion_r3146555596
##########
plugin-nestedstructure/src/main/java/org/apache/ranger/authorization/nestedstructure/authorizer/RecordFilterJavaScript.java:
##########
@@ -78,25 +145,89 @@ public static boolean filterRow(String user, String
filterExpr, String jsonStrin
}
}
+ private static ScriptEngine resolveJavaScriptEngine(ScriptEngineManager
mgr) {
+ String[] tryNames = {"graal.js", "nashorn", "js", "JavaScript",
"javascript"};
Review Comment:
Instead of hardcoding the engine names here, we should define them as static
constants. This improves readability, avoids typos, and makes it easy to
update/add engines in one place.
Suggestion:
private static final String GRAAL_JS = "graal.js";
private static final String NASHORN = "nashorn";
private static final String JS = "js";
private static final String JAVASCRIPT = "JavaScript";
private static final String JAVASCRIPT_LC = "javascript";
private static final String[] SUPPORTED_JS_ENGINES = {
GRAAL_JS, NASHORN, JS, JAVASCRIPT_LC
};
String[] tryNames = SUPPORTED_JS_ENGINES;
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]