[java-identity-provider] branch main updated: IDP-2044 Scripted object constructors and initialization
Rod Widdowson
rdw at steadingsoftware.com
Wed Jun 21 15:48:05 UTC 2023
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=255f3a7b45d5a7f271d157191b0f180399384f39
The following commit(s) were added to refs/heads/main by this push:
new 255f3a7b4 IDP-2044 Scripted object constructors and initialization
255f3a7b4 is described below
commit 255f3a7b45d5a7f271d157191b0f180399384f39
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Jun 21 16:41:25 2023 +0100
IDP-2044 Scripted object constructors and initialization
https://shibboleth.atlassian.net/browse/IDP-2044
Having removed the deprecated (initializeWithScriptException) method
make the factory methods throw ComponentInitalizationException
as well.
These are only used as beans and in tests.
---
.../net/shibboleth/idp/profile/ScriptedAction.java | 18 ++++++++++--------
.../idp/profile/logic/ScriptedPredicate.java | 16 ++++++++++------
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java
index c671a0544..77b842626 100644
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java
@@ -125,15 +125,15 @@ public class ScriptedAction extends AbstractProfileAction {
* @return the predicate
* @throws ScriptException if the compile fails
* @throws IOException if the file doesn't exist.
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
- @SuppressWarnings("removal")
public static ScriptedAction resourceScript(@Nonnull @NotEmpty final String engineName,
@Nonnull final Resource resource)
- throws ScriptException, IOException {
+ throws ScriptException, IOException, ComponentInitializationException {
final EvaluableScript script = new EvaluableScript();
script.setEngineName(engineName);
script.setScript(resource);
- script.initializeWithScriptException();
+ script.initialize();
return new ScriptedAction(script);
}
@@ -144,9 +144,10 @@ public class ScriptedAction extends AbstractProfileAction {
* @return the predicate
* @throws ScriptException if the compile fails
* @throws IOException if the file doesn't exist.
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
public static ScriptedAction resourceScript(@Nonnull final Resource resource)
- throws ScriptException, IOException {
+ throws ScriptException, IOException, ComponentInitializationException {
return resourceScript(DEFAULT_ENGINE, resource);
}
@@ -157,14 +158,14 @@ public class ScriptedAction extends AbstractProfileAction {
* @param engineName the language
* @return the predicate
* @throws ScriptException if the compile fails
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
- @SuppressWarnings("removal")
public static ScriptedAction inlineScript(@Nonnull @NotEmpty final String engineName,
- @Nonnull @NotEmpty final String scriptSource) throws ScriptException {
+ @Nonnull @NotEmpty final String scriptSource) throws ScriptException, ComponentInitializationException {
final EvaluableScript script = new EvaluableScript();
script.setEngineName(engineName);
script.setScript(scriptSource);
- script.initializeWithScriptException();
+ script.initialize();
return new ScriptedAction(script);
}
@@ -174,8 +175,9 @@ public class ScriptedAction extends AbstractProfileAction {
* @param scriptSource the script, as a string
* @return the predicate
* @throws ScriptException if the compile fails
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
- public static ScriptedAction inlineScript(@Nonnull @NotEmpty final String scriptSource) throws ScriptException {
+ public static ScriptedAction inlineScript(@Nonnull @NotEmpty final String scriptSource) throws ScriptException, ComponentInitializationException {
return inlineScript(DEFAULT_ENGINE, scriptSource);
}
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
index 230b9070a..797eff245 100644
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
@@ -27,6 +27,7 @@ import org.springframework.core.io.Resource;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.primitive.DeprecationSupport;
import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
import net.shibboleth.shared.scripting.EvaluableScript;
@@ -72,13 +73,14 @@ public class ScriptedPredicate extends net.shibboleth.profile.context.logic.Scri
* @return the predicate
* @throws ScriptException if the compile fails
* @throws IOException if the file doesn't exist.
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
public static ScriptedPredicate resourceScript(@Nonnull @NotEmpty final String engineName,
- @Nonnull final Resource resource) throws ScriptException, IOException {
+ @Nonnull final Resource resource) throws ScriptException, IOException, ComponentInitializationException {
final EvaluableScript script = new EvaluableScript();
script.setEngineName(engineName);
script.setScript(ResourceHelper.of(resource));
- script.initializeWithScriptException();
+ script.initialize();
return new ScriptedPredicate(script, resource.getDescription());
}
@@ -89,9 +91,10 @@ public class ScriptedPredicate extends net.shibboleth.profile.context.logic.Scri
* @return the predicate
* @throws ScriptException if the compile fails
* @throws IOException if the file doesn't exist.
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
public static ScriptedPredicate resourceScript(@Nonnull final Resource resource)
- throws ScriptException, IOException {
+ throws ScriptException, IOException, ComponentInitializationException {
return resourceScript(DEFAULT_ENGINE, resource);
}
@@ -102,13 +105,14 @@ public class ScriptedPredicate extends net.shibboleth.profile.context.logic.Scri
* @param engineName the language
* @return the predicate
* @throws ScriptException if the compile fails
+ * @throws ComponentInitializationException if the scripting initialization fails
*/
public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty final String engineName,
- @Nonnull @NotEmpty final String scriptSource) throws ScriptException {
+ @Nonnull @NotEmpty final String scriptSource) throws ScriptException, ComponentInitializationException {
final EvaluableScript script = new EvaluableScript();
script.setEngineName(engineName);
script.setScript(scriptSource);
- script.initializeWithScriptException();
+ script.initialize();
return new ScriptedPredicate(script, "Inline");
}
@@ -119,7 +123,7 @@ public class ScriptedPredicate extends net.shibboleth.profile.context.logic.Scri
* @return the predicate
* @throws ScriptException if the compile fails
*/
- public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty final String scriptSource) throws ScriptException {
+ public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty final String scriptSource) throws ScriptException, ComponentInitializationException {
return inlineScript(DEFAULT_ENGINE, scriptSource);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list