[java-metadata-aggregator] 02/02: MDA-146 loosen SAMLMetadataSupport#getDescriptorExtensions contract

Ian Young ian at iay.org.uk
Thu Dec 3 13:01:57 EST 2015


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

iay pushed a commit to branch master
in repository java-metadata-aggregator.

commit e7ba2b3a6317627762944adf6b04f237e1388d2d
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Thu Dec 3 18:03:01 2015 +0000

    MDA-146 loosen SAMLMetadataSupport#getDescriptorExtensions contract
    
    No longer restricted to EntityDescriptor and EntitiesDescriptor, and is
    therefore now also available on role descriptors as well.
---
 .../shibboleth/metadata/dom/saml/SAMLMetadataSupport.java | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java
index 2b534aa..7276410 100644
--- a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java
+++ b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java
@@ -95,25 +95,24 @@ public final class SAMLMetadataSupport {
     /**
      * Gets the first instance of an extension element for a given descriptor.
      * 
-     * @param descriptor the entity or entities descriptor, never null
-     * @param extensionName the name of the extension element, never null
+     * @param descriptor the descriptor, never <code>null</code>
+     * @param extensionName the name of the extension element, never <code>null</code>
      * 
-     * @return the first instance of the extension element or null if either argument is null, the given element is not
-     *         an EntitiesDescriptor or EntityDescriptor, or no such element exists as an extension of the descriptor
+     * @return the first instance of the extension element or <code>null</code> if either argument is null,
+     *          or no such element exists as an extension of the descriptor
      */
     public static Element getDescriptorExtensions(@Nullable final Element descriptor,
             @Nullable final QName extensionName) {
-        if (descriptor == null || extensionName == null
-                || (!isEntitiesDescriptor(descriptor) && !isEntityDescriptor(descriptor))) {
+        if (descriptor == null || extensionName == null) {
             return null;
         }
 
-        List<Element> extensions = ElementSupport.getChildElements(descriptor, EXTENSIONS_NAME);
+        final List<Element> extensions = ElementSupport.getChildElements(descriptor, EXTENSIONS_NAME);
         if (extensions.isEmpty()) {
             return null;
         }
 
-        List<Element> results = ElementSupport.getChildElements(extensions.get(0), extensionName);
+        final List<Element> results = ElementSupport.getChildElements(extensions.get(0), extensionName);
         if (results.isEmpty()) {
             return null;
         }

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


More information about the commits mailing list