[spring-extensions] branch master updated: JSPT-95 use non deprecated EvaluableScript constructors

Rod Widdowson rdw at steadingsoftware.com
Wed Jun 10 14:26:47 UTC 2020


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

rdw pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=4de6e8c1b0b48ee1e316efe44b979d1292369d98

The following commit(s) were added to refs/heads/master by this push:
       new  4de6e8c   JSPT-95 use non deprecated EvaluableScript constructors
4de6e8c is described below

commit 4de6e8c1b0b48ee1e316efe44b979d1292369d98
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Mar 28 16:30:26 2020 +0000

    JSPT-95 use non deprecated EvaluableScript constructors
    
    https://issues.shibboleth.net/jira/browse/JSPT-95
---
 .../ext/spring/factory/EvaluableScriptFactoryBean.java  | 17 +++++++++++------
 .../ext/spring/resource/RunnableResourceTest.java       |  8 ++++++--
 .../shibboleth/ext/spring/resource/RunnableResource.xml |  2 +-
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/factory/EvaluableScriptFactoryBean.java b/src/main/java/net/shibboleth/ext/spring/factory/EvaluableScriptFactoryBean.java
index 8251d28..2ed791f 100644
--- a/src/main/java/net/shibboleth/ext/spring/factory/EvaluableScriptFactoryBean.java
+++ b/src/main/java/net/shibboleth/ext/spring/factory/EvaluableScriptFactoryBean.java
@@ -141,14 +141,19 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
                 script = StringSupport.inputStreamToString(is, null);
             }
         }
-        log.debug("{} Script: {}", sourceId, script);
+        log.debug("{} Language: {} Script: {} ", sourceId, engineName==null ? "<default>" : engineName, script);
 
-        if (null == engineName) {
-            log.debug("{} default language", sourceId);
-            return new EvaluableScript(script);
+        final EvaluableScript evaluableScript = new EvaluableScript();
+        evaluableScript.setScript(script);
+
+        if (engineName != null) {
+            evaluableScript.setEngineName(engineName);
         }
-        log.debug("{} language : {}", sourceId, engineName);
-        return new EvaluableScript(engineName, script);
+        //
+        // Initialize for compatibility reasons
+        //
+        evaluableScript.initialize();
+        return evaluableScript;
     }
 
 }
diff --git a/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java b/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
index 77233d4..f8d21cb 100644
--- a/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
@@ -86,7 +86,9 @@ public class RunnableResourceTest {
     
     
     @Test public void testRunnable() throws ScriptException, ComponentInitializationException {
-        final EvaluableScript script = new EvaluableScript("custom.update();");
+        final EvaluableScript script = new EvaluableScript();
+        script.setScript("custom.update();");
+        script.initialize();
         final ScriptedRunnable runnable = new ScriptedRunnable();
         runnable.setCustomObject(object);
         runnable.setScript(script);
@@ -108,7 +110,9 @@ public class RunnableResourceTest {
     @Test public void testResource() throws ScriptException, ComponentInitializationException, IOException, InterruptedException {
         
         final long now = new File(fileName).lastModified();
-        final EvaluableScript script = new EvaluableScript("custom.update();");
+        final EvaluableScript script = new EvaluableScript();
+        script.setScript("custom.update();");
+        script.initialize();
         final ScriptedRunnable runnable = new ScriptedRunnable();
         runnable.setCustomObject(object);
         runnable.setScript(script);
diff --git a/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml b/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml
index 8b9f064..aa060c6 100644
--- a/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml
+++ b/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml
@@ -6,7 +6,7 @@
     
     <bean id="shibboleth.IdentifiableBeanPostProcessor" class="net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor" />
     
-    <bean id="Script" class="net.shibboleth.utilities.java.support.scripting.EvaluableScript" c:_0="
+    <bean id="Script" class="net.shibboleth.utilities.java.support.scripting.EvaluableScript" init-method="initialize" p:script="
     var i = 22;
     var j = 7;
     var pi = i/j;

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


More information about the commits mailing list