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

noreply at shibboleth.net noreply at shibboleth.net
Tue Nov 8 18:58:25 EST 2016


Author: putmanb
Date: Tue Nov  8 18:58:25 2016
New Revision: 4574

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4574&view=rev
Log:
OSJ-182: Add Metrics instrumentation to dynamic metadata resolvers

Address another minor issue where one case is incorrectly recorded as "loaded" when it really wasn't.

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

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java	(original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java	Tue Nov  8 18:58:25 2016
@@ -636,7 +636,12 @@
      */
     @Nonnull protected void processNewMetadata(@Nonnull final XMLObject root, @Nonnull final String expectedEntityID) 
             throws FilterException {
-        processNewMetadata(root, expectedEntityID, false);
+        try {
+            processNewMetadata(root, expectedEntityID, false);
+        } catch (ResolverException e) {
+            //TODO this is kludgy, but necessary until we can change the API to add an exception to the method signature
+            throw new FilterException(e);
+        }
     }
     
     /**
@@ -654,10 +659,11 @@
      * @param fromPersistentCache whether the entity data was loaded from the persistent cache
      * 
      * @throws FilterException if there is a problem filtering the metadata
-     */
-    //CheckStyle: ReturnCount OFF
+     * @throws ResolverException if there is a problem processing the metadata
+     */
+    //CheckStyle: ReturnCount|CyclomaticComplexity OFF
     @Nonnull protected void processNewMetadata(@Nonnull final XMLObject root, @Nonnull final String expectedEntityID,
-            final boolean fromPersistentCache) throws FilterException {
+            final boolean fromPersistentCache) throws FilterException, ResolverException {
         
         final XMLObject filteredMetadata = filterMetadata(prepareForFiltering(root));
         
@@ -676,7 +682,11 @@
             if (!Objects.equals(entityDescriptor.getEntityID(), expectedEntityID)) {
                 log.warn("New metadata's entityID '{}' does not match expected entityID '{}', will not process", 
                         entityDescriptor.getEntityID(), expectedEntityID);
-               return; 
+                if (fromPersistentCache) {
+                    throw new ResolverException("New metadata's entityID does not match expected entityID");
+                } else {
+                    return; 
+                }
             }
             
             preProcessEntityDescriptor(entityDescriptor, getBackingStore());
@@ -708,7 +718,7 @@
         releaseMetadataDOM(root);
     
     }
-    //CheckStyle: ReturnCount ON
+    //CheckStyle: ReturnCount|CyclomaticComplexity ON
     
     /**
      * Prepare the object for filtering:  If persistent caching is enabled, return a clone of the object
@@ -991,7 +1001,7 @@
                     log.trace("Successfully processed EntityDescriptor with entityID '{}' from cache", 
                             descriptor.getEntityID());
                     persistentCacheInitMetrics.entriesLoaded++;
-                } catch (final FilterException e) {
+                } catch (final FilterException | ResolverException e) {
                     log.warn("Error processing EntityDescriptor '{}' from cache with storage key '{}'", 
                             descriptor.getEntityID(), currentKey, e);
                     persistentCacheInitMetrics.entriesSkippedProcessingException++;



More information about the commits mailing list