[java-plugin-storage-jdbc] branch main updated: JJDBC-26 Problems with JDBCStorageService

Rod Widdowson rdw at steadingsoftware.com
Tue Sep 3 12:23:15 UTC 2024


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

rdw pushed a commit to branch main
in repository java-plugin-storage-jdbc.

View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-storage-jdbc.git;a=commit;h=dc7535f7f6cb80292dd3d459310500d73bb0dea8

The following commit(s) were added to refs/heads/main by this push:
     new dc7535f  JJDBC-26 Problems with JDBCStorageService
dc7535f is described below

commit dc7535f7f6cb80292dd3d459310500d73bb0dea8
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Sep 3 13:22:03 2024 +0100

    JJDBC-26 Problems with JDBCStorageService
    
    https://shibboleth.atlassian.net/browse/JJDBC-26
    
    Java Types and non intuitive and complicated.  Abhor comparing
    Logg object using `==`
---
 .../shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java  | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
index f5ecaca..b8ba682 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
@@ -686,12 +686,12 @@ public final class JDBCStorageService extends AbstractStorageService
                     final String returnedValue =
                             Constraint.isNotNull(resultSet.getString(3), "value field must not be null");
                     log.trace("Considering Version '{}', Expires '{}', Value '{}'",
-                              returnedVersion, returnedValue, returnedExpires);
+                              returnedVersion, returnedExpires, returnedValue);
                     if (returnedExpires != null && System.currentTimeMillis() >= returnedExpires) {
                         log.debug("Read failed, key '{}' expired in context '{}'", key, context);
                         return new Pair<>();
                     }
-                    if (version != null && returnedVersion == version) {
+                    if (version != null && version.equals(returnedVersion)) {
                         // Nothing's changed, so just echo back the version.
                         return new Pair<>(version, null);
                     }
@@ -811,8 +811,7 @@ public final class JDBCStorageService extends AbstractStorageService
                         log.debug("Update failed, key '{}' expired in context '{}'", key, context);
                         return null;
                     }
-        
-                    if (version != null && returnedVersion != version) {
+                    if (version != null && !version.equals(returnedVersion)) {
                         // Caller is out of sync.
                         throw new VersionMismatchException();
                     }
@@ -904,7 +903,7 @@ public final class JDBCStorageService extends AbstractStorageService
                         return false;
                     }
                     final Long returnedVersion = resultSet.getLong(1);
-                    if (version != null && returnedVersion != version) {
+                    if (version != null && !version.equals(returnedVersion)) {
                         throw new VersionMismatchException();
                     }
                 }

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


More information about the commits mailing list