[java-opensaml] branch main updated: IDP-2069 Null handling
Rod Widdowson
rdw at steadingsoftware.com
Thu Mar 9 14:04:39 UTC 2023
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=e0088721dfcbcece6eee381e4a4064c4fa4edd86
The following commit(s) were added to refs/heads/main by this push:
new e0088721d IDP-2069 Null handling
e0088721d is described below
commit e0088721dfcbcece6eee381e4a4064c4fa4edd86
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Mar 9 13:21:32 2023 +0000
IDP-2069 Null handling
https://shibboleth.atlassian.net/browse/IDP-2069
Deprecate the two parameter versions of BaseContext#getsubContext()
Add a new method to BaseContext to remove the context from its parent
(if there is one)
---
.../org/opensaml/messaging/context/BaseContext.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/BaseContext.java b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/BaseContext.java
index 955de3c4e..7b53c8f34 100644
--- a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/BaseContext.java
+++ b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/BaseContext.java
@@ -126,7 +126,9 @@ public abstract class BaseContext implements Iterable<BaseContext> {
* @param autocreate flag indicating whether the subcontext instance should be auto-created
*
* @return the held instance of the class, or null
+ * @deprecated use {@link #getOrCreateSubcontext(Class)} or {#link {@link #getSubcontext(Class)}.
*/
+ @Deprecated(since = "5.0.0", forRemoval = false)
@Nullable public <T extends BaseContext> T getSubcontext(@Nonnull final Class<T> clazz, final boolean autocreate) {
Constraint.isNotNull(clazz, "Class type cannot be null");
@@ -182,7 +184,9 @@ public abstract class BaseContext implements Iterable<BaseContext> {
* @param autocreate flag indicating whether the subcontext instance should be auto-created
*
* @return the held instance of the class, or null
+ * @deprecated use {@link #getOrCreateSubcontext(String)} or {#link {@link #getSubcontext(String)}.
*/
+ @Deprecated(since = "5.0.0", forRemoval = false)
@Nullable public BaseContext getSubcontext(@Nonnull @NotEmpty final String className, final boolean autocreate) {
try {
return getSubcontext(Class.forName(className).asSubclass(BaseContext.class), autocreate);
@@ -273,7 +277,17 @@ public abstract class BaseContext implements Iterable<BaseContext> {
subcontext.setParent(null);
subcontexts.remove(subcontext);
}
-
+
+ /** Remove from our parent (if there is one).
+ */
+ public void removeFromParent() {
+ final BaseContext parent = getParent();
+ if (parent == null) {
+ return;
+ }
+ parent.removeSubcontext(this);
+ }
+
/**
* Remove the subcontext from the current context which corresponds to the supplied class.
*
@@ -281,7 +295,7 @@ public abstract class BaseContext implements Iterable<BaseContext> {
* @param clazz the subcontext class to remove
*/
public <T extends BaseContext>void removeSubcontext(@Nonnull final Class<T> clazz) {
- final BaseContext subcontext = getSubcontext(clazz, false);
+ final BaseContext subcontext = getSubcontext(clazz);
if (subcontext != null) {
removeSubcontext(subcontext);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list