[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/saml2/metadata/provider/Abstract...

noreply at shibboleth.net noreply at shibboleth.net
Fri Mar 22 15:15:40 EDT 2013


Author: putmanb
Date: Fri Mar 22 15:15:40 2013
New Revision: 3273

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3273&view=rev
Log:
Porting JOST-208 from v2.

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/AbstractMetadataProvider.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/FileBackedHTTPMetadataProvider.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/provider/FileBackedHTTPMetadataProviderTest.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/AbstractMetadataProvider.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/AbstractMetadataProvider.java?rev=3273&r1=3272&r2=3273&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/AbstractMetadataProvider.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/AbstractMetadataProvider.java Fri Mar 22 15:15:40 2013
@@ -413,10 +413,11 @@
             initialized = true;
         } catch (MetadataProviderException e) {
             if (failFastInitialization) {
-                log.error("Metadata provider failed to properly initializing, halting", e);
+                log.error("Metadata provider failed to properly initialize, fail-fast=true, halting", e);
                 throw e;
             } else {
-                log.error("Metadata provider failed to properly initializing, continuing on without metadata", e);
+                log.error("Metadata provider failed to properly initialize, fail-fast=false, " 
+                        + "continuing on in a degraded state", e);
                 initialized = true;
             }
         }

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/FileBackedHTTPMetadataProvider.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/FileBackedHTTPMetadataProvider.java?rev=3273&r1=3272&r2=3273&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/FileBackedHTTPMetadataProvider.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/provider/FileBackedHTTPMetadataProvider.java Fri Mar 22 15:15:40 2013
@@ -54,7 +54,7 @@
      * @param backupFilePath the file that will keep a backup copy of the metadata,
      * 
      * @throws MetadataProviderException thrown if the URL is not a valid URL, the metadata can not be retrieved from
-     *             the URL, the given file can not be created or written to
+     *             the URL
      */
     @Deprecated
     public FileBackedHTTPMetadataProvider(String metadataURL, int requestTimeout, String backupFilePath)
@@ -72,7 +72,7 @@
      * @param backupFilePath the file that will keep a backup copy of the metadata,
      * 
      * @throws MetadataProviderException thrown if the URL is not a valid URL, the metadata can not be retrieved from
-     *             the URL, the given file can not be created or written to
+     *             the URL
      */
     public FileBackedHTTPMetadataProvider(Timer backgroundTaskTimer, HttpClient client, String metadataURL,
             String backupFilePath) throws MetadataProviderException {
@@ -87,6 +87,22 @@
         super.destroy();
     }
 
+    /** {@inheritDoc} */
+    protected void doInitialization() throws MetadataProviderException {
+        try {
+            validateBackupFile(metadataBackupFile);
+        } catch (MetadataProviderException e) {
+            if (isFailFastInitialization()) {
+                log.error("Metadata backup file path was invalid, initialization is fatal");
+                throw e;
+            } else {
+                log.error("Metadata backup file path was invalid, continuing without known good backup file");
+            }
+        }
+        
+        super.doInitialization();
+    }
+
     /**
      * Sets the file used to backup metadata. The given file path is checked to see if it is a read/writable file if it
      * exists or if can be created if it does not exist.
@@ -97,31 +113,40 @@
      */
     protected void setBackupFile(String backupFilePath) throws MetadataProviderException {
         File backingFile = new File(backupFilePath);
+        metadataBackupFile = backingFile;
+    }
 
-        if (!backingFile.exists()) {
+    /**
+     * Validate the basic properties of the specified metadata backup file, for example that it 
+     * exists and/or can be created; that it is not a directory; and that it is readable and writable.
+     *
+     * @param backupFile the file to evaluate
+     * @throws MetadataProviderException if file does not pass basic properties required of a metadata backup file
+     */

[... 251 lines stripped ...]


More information about the commits mailing list