[java-opensaml] 02/02: Collapse sequence of a conditional and its inverse into an if/else.

Brent Putman putmanb at georgetown.edu
Thu Jun 3 23:35:59 UTC 2021


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

putmanb 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=8fe2f39f3392cf000614c053efae1a89bd36b246

commit 8fe2f39f3392cf000614c053efae1a89bd36b246
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Thu Jun 3 19:32:18 2021 -0400

    Collapse sequence of a conditional and its inverse into an if/else.
    
    No reason to run the second block's tests on the case where the
    backup file didn't originally exist and a test file was created
    and then deleted.
    
    It's suspected that on Windows the test file deletion in block 1 might
    sometimes be in a partially-deleted state such that in block 2
    File#exists() is true but either #canRead() or #canWrite() are false,
    causing an unnecessary failure.
---
 .../saml/metadata/resolver/impl/FileBackedHTTPMetadataResolver.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolver.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolver.java
index ed6857108..6220f21a1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolver.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolver.java
@@ -256,9 +256,7 @@ public class FileBackedHTTPMetadataResolver extends HTTPMetadataResolver {
                     }
                 }
             }
-        }
-
-        if (backupFile.exists()) {
+        } else {
             if (backupFile.isDirectory()) {
                 throw new ResolverException("Filepath " + backupFile.getAbsolutePath()
                 + " is a directory and may not be used as a backup metadata file");

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


More information about the commits mailing list