[java-idp-plugin-scripting] branch main updated: JSCRIPTING-16 Review and fix Null annotations

Rod Widdowson rdw at steadingsoftware.com
Thu Jun 22 13:37:06 UTC 2023


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-idp-plugin-scripting.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-scripting.git;a=commit;h=85affade047f34aa7be3df9e0427d4f8eae0916f

The following commit(s) were added to refs/heads/main by this push:
     new 85affad  JSCRIPTING-16 Review and fix Null annotations
85affad is described below

commit 85affade047f34aa7be3df9e0427d4f8eae0916f
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Jun 22 14:22:00 2023 +0100

    JSCRIPTING-16 Review and fix Null annotations
    
    https://shibboleth.atlassian.net/browse/JSCRIPTING-16
---
 .../shibboleth/idp/plugin/scripting/rhino/RhinoEngine.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoEngine.java b/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoEngine.java
index 8f689bc..4c08e0b 100644
--- a/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoEngine.java
+++ b/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoEngine.java
@@ -17,6 +17,7 @@
 
 package net.shibboleth.idp.plugin.scripting.rhino;
 
+import javax.annotation.Nonnull;
 import javax.script.Bindings;
 import javax.script.Compilable;
 import javax.script.CompiledScript;
@@ -61,7 +62,8 @@ public class RhinoEngine extends AbstractScriptEngine implements ScriptEngine, C
     }
 
     /** {@inheritDoc} */
-    public CompiledScript compile(final String script) throws ScriptException {
+    public CompiledScript compile(String script) throws ScriptException {
+        assert script != null;
         return new CompiledScriptImpl(script);
     }
     
@@ -69,16 +71,18 @@ public class RhinoEngine extends AbstractScriptEngine implements ScriptEngine, C
     private class CompiledScriptImpl extends CompiledScript {
 
         /** The compiled script. */
-        private final Script script;
+        @Nonnull private final Script script;
         
         /** Constructor.
          *
          * @param source what to compile up.
          */
-        public CompiledScriptImpl(final String source) {
+        public CompiledScriptImpl(@Nonnull final String source) {
             final Context ctx = Context.enter();
             try {
-                script = ctx.compileString(source, "Script", 1, null);  
+                final Script sc = ctx.compileString(source, "Script", 1, null);
+                assert sc != null;
+                script = sc;
             } finally {
                 Context.exit();
             }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list