[java-opensaml COMMIT] /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/Metadat...

noreply at shibboleth.net noreply at shibboleth.net
Tue Oct 4 20:01:07 EDT 2016


Author: putmanb
Date: Tue Oct  4 20:01:06 2016
New Revision: 4511

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4511&view=rev
Log:
Invert the composition of function and iteration, so as not to call function more than once.

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManager.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManager.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManager.java?rev=4511&r1=4510&r2=4511&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManager.java	(original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManager.java	Tue Oct  4 20:01:06 2016
@@ -163,21 +163,21 @@
      * @param descriptor the entity descriptor to index
      */
     public void indexEntityDescriptor(@Nonnull final EntityDescriptor descriptor) {
-        for (MetadataIndex index : indexes.keySet()) {
-            Set<MetadataIndexKey> keys = index.generateKeys(descriptor);
-            if (keys != null && !keys.isEmpty()) {
-                T item = entityDescriptorFunction.apply(descriptor);
-                if (item != null) {
+        T item = entityDescriptorFunction.apply(descriptor);
+        if (item != null) {
+            for (MetadataIndex index : indexes.keySet()) {
+                Set<MetadataIndexKey> keys = index.generateKeys(descriptor);
+                if (keys != null && !keys.isEmpty()) {
                     MetadataIndexStore<T> store = getStore(index);
                     for (MetadataIndexKey key : keys) {
                         log.trace("Indexing metadata: index '{}', key '{}', data item '{}'", 
                                 index, key, item);
                         store.add(key, item);
                     }
-                } else {
-                    log.trace("Unable to extract indexed data item from EntityDescriptor");
-                }
-            }
+                }
+            }
+        } else {
+            log.trace("Unable to extract indexed data item from EntityDescriptor");
         }
     }
     



More information about the commits mailing list