[java-opensaml] branch master updated: JSPT-79 - Review date and time handling for Java 8

Scott Cantor cantor.2 at osu.edu
Fri Mar 8 13:37:17 EST 2019


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

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

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

The following commit(s) were added to refs/heads/master by this push:
       new  a323b4e   JSPT-79 - Review date and time handling for Java 8
a323b4e is described below

commit a323b4e82ec8307d9b6545219a85fd485bd93863
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Mar 8 13:37:12 2019 -0500

    JSPT-79 - Review date and time handling for Java 8
    
    https://issues.shibboleth.net/jira/browse/JSPT-79
    
    Remediate Duration annotation use out of java-support.
---
 .../java/org/opensaml/storage/impl/client/ClientStorageService.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java b/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
index 126b231..b2209ce 100644
--- a/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
+++ b/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
@@ -21,6 +21,8 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.security.KeyException;
+import java.time.Duration;
+import java.time.Instant;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.TimerTask;
@@ -538,7 +540,7 @@ public class ClientStorageService extends AbstractMapBackedStorageService implem
                     }
                     
                     // Create new context if necessary.
-                    Map<String,MutableStorageRecord> dataMap = contextMap.get(context);
+                    Map<String,MutableStorageRecord> dataMap = contextMap.get(context.getKey());
                     if (dataMap == null) {
                         dataMap = new HashMap<>();
                         contextMap.put(context.getKey(), dataMap);
@@ -663,7 +665,7 @@ public class ClientStorageService extends AbstractMapBackedStorageService implem
                 log.trace("{} Data before encryption is {}", getLogPrefix(), raw);
                 try {
                     final String wrapped = dataSealer.wrap(raw,
-                            exp > 0 ? exp : System.currentTimeMillis() + 24 * 60 * 60 * 1000);
+                            exp > 0 ? Instant.ofEpochMilli(exp) : Instant.now().plus(Duration.ofDays(1)));
                     log.trace("{} Size of data after encryption is {}", getLogPrefix(), wrapped.length());
                     setDirty(false);
                     return new ClientStorageServiceOperation(getId(), getStorageName(), wrapped, source);

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


More information about the commits mailing list