[java-opensaml] 01/09: OSJ-413 - StorageService implementations compare version improperly

Scott Cantor cantor.2 at osu.edu
Thu Mar 13 18:41:52 UTC 2025


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

scantor pushed a commit to branch maint-5.1
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=d04d7b5cd994bbec6f8406a799bbd6252d20ed2d

commit d04d7b5cd994bbec6f8406a799bbd6252d20ed2d
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 3 08:48:24 2024 -0400

    OSJ-413 - StorageService implementations compare version improperly
    
    https://shibboleth.atlassian.net/browse/OSJ-413
---
 .../java/org/opensaml/storage/AbstractMapBackedStorageService.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractMapBackedStorageService.java b/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractMapBackedStorageService.java
index 51cd93e12..37c114b8f 100644
--- a/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractMapBackedStorageService.java
+++ b/opensaml-storage-api/src/main/java/org/opensaml/storage/AbstractMapBackedStorageService.java
@@ -353,7 +353,7 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
                 return new Pair<>();
             }
             
-            if (version != null && record.getVersion() == version) {
+            if (version != null && version.equals(record.getVersion())) {
                 // Nothing's changed, so just echo back the version.
                 return new Pair<>(version, null);
             }
@@ -411,7 +411,7 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
                 return null;
             }
     
-            if (version != null && version != record.getVersion()) {
+            if (version != null && !version.equals(record.getVersion())) {
                 // Caller is out of sync.
                 throw new VersionMismatchException();
             }
@@ -471,7 +471,7 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
             if (record == null) {
                 log.debug("Deleting record '{}' in context '{}'....key not found", key, context);
                 return false;
-            } else if (version != null && record.getVersion() != version) {
+            } else if (version != null && !version.equals(record.getVersion())) {
                 throw new VersionMismatchException();
             } else {
                 setDirty();

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


More information about the commits mailing list