[java-opensaml] 02/12: JPAR-85 - Checkstyle, check final variables

Tom Zeller tzeller at dragonacea.biz
Thu Aug 10 18:25:51 EDT 2017


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

tzeller 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=70dd36dea5cdba782bbff11867a9fe5fd375573f

commit 70dd36dea5cdba782bbff11867a9fe5fd375573f
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Aug 10 16:21:51 2017 -0500

    JPAR-85 - Checkstyle, check final variables
---
 .../storage/AbstractMapBackedStorageService.java   | 22 +++++++++++-----------
 .../java/org/opensaml/storage/ReplayCache.java     |  6 +++---
 2 files changed, 14 insertions(+), 14 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 8f8af64..f23acee 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
@@ -83,10 +83,10 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
             }
             
             // Check for a duplicate.
-            StorageRecord record = dataMap.get(key);
+            final StorageRecord record = dataMap.get(key);
             if (record != null) {
                 // Not yet expired?
-                Long exp = record.getExpiration();
+                final Long exp = record.getExpiration();
                 if (exp == null || System.currentTimeMillis() < exp) {
                     return false;
                 }
@@ -187,8 +187,8 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
             final Map<String, MutableStorageRecord> dataMap = contextMap.get(context);
             if (dataMap != null) {    
                 setDirty();
-                Long now = System.currentTimeMillis();
-                for (MutableStorageRecord record : dataMap.values()) {
+                final Long now = System.currentTimeMillis();
+                for (final MutableStorageRecord record : dataMap.values()) {
                     final Long exp = record.getExpiration();
                     if (exp == null || now < exp) {
                         record.setExpiration(expiration);
@@ -295,7 +295,7 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
     @Nonnull protected Pair<Long, StorageRecord> readImpl(@Nonnull @NotEmpty final String context,
             @Nonnull @NotEmpty final String key, @Nullable final Long version) throws IOException {
 
-        Lock readLock = getLock().readLock();
+        final Lock readLock = getLock().readLock();
         try {
             readLock.lock();
             
@@ -313,12 +313,12 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
                 return new Pair();
             }
 
-            StorageRecord record = dataMap.get(key);
+            final StorageRecord record = dataMap.get(key);
             if (record == null) {
                 log.debug("Read failed, key '{}' not found in context '{}'", key, context);
                 return new Pair();
             } else {
-                Long exp = record.getExpiration();
+                final Long exp = record.getExpiration();
                 if (exp != null && System.currentTimeMillis() >= exp) {
                     log.debug("Read failed, key '{}' expired in context '{}'", key, context);
                     return new Pair();
@@ -372,12 +372,12 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
                 return null;
             }
             
-            MutableStorageRecord record = dataMap.get(key);
+            final MutableStorageRecord record = dataMap.get(key);
             if (record == null) {
                 log.debug("Update failed, key '{}' not found in context '{}'", key, context);
                 return null;
             } else {
-                Long exp = record.getExpiration();
+                final Long exp = record.getExpiration();
                 if (exp != null && System.currentTimeMillis() >= exp) {
                     log.debug("Update failed, key '{}' expired in context '{}'", key, context);
                     return null;
@@ -440,7 +440,7 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
                 return false;
             }
 
-            MutableStorageRecord record = dataMap.get(key);
+            final MutableStorageRecord record = dataMap.get(key);
             if (record == null) {
                 log.debug("Deleting record '{}' in context '{}'....key not found", key, context);
                 return false;
@@ -475,7 +475,7 @@ public abstract class AbstractMapBackedStorageService extends AbstractStorageSer
         
         return Iterables.removeIf(dataMap.entrySet(), new Predicate<Entry<String, MutableStorageRecord>>() {
                 public boolean apply(@Nullable final Entry<String, MutableStorageRecord> entry) {
-                    Long exp = entry.getValue().getExpiration();
+                    final Long exp = entry.getValue().getExpiration();
                     return exp != null && exp <= expiration;
                 }
             }
diff --git a/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java b/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java
index 89a4d51..2aa2d46 100644
--- a/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java
+++ b/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java
@@ -118,9 +118,9 @@ public class ReplayCache extends AbstractIdentifiableInitializableComponent {
     public synchronized boolean check(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String s,
             final long expires) {
 
-        String key;
+        final String key;
         
-        StorageCapabilities caps = storage.getCapabilities();
+        final StorageCapabilities caps = storage.getCapabilities();
         if (context.length() > caps.getContextSize()) {
             log.error("context {} too long for StorageService (limit {})", context, caps.getContextSize());
             return false;
@@ -131,7 +131,7 @@ public class ReplayCache extends AbstractIdentifiableInitializableComponent {
         }
 
         try {
-            StorageRecord entry = storage.read(context, key);
+            final StorageRecord entry = storage.read(context, key);
             if (entry == null) {
                 log.debug("Value '{}' was not a replay, adding to cache with expiration time {}", s, expires);
                 storage.create(context, key, "x", expires);

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


More information about the commits mailing list