[java-opensaml COMMIT] /trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageServi...

noreply at shibboleth.net noreply at shibboleth.net
Wed Mar 23 20:40:11 EDT 2016


Author: scantor
Date: Wed Mar 23 20:40:10 2016
New Revision: 4435

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4435&view=rev
Log:
Skip writing out empty contexts to avoid accumulation.

Modified:
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java?rev=4435&r1=4434&r2=4435&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java	(original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java	Wed Mar 23 20:40:10 2016
@@ -610,22 +610,24 @@
                 
                 gen.writeStartObject();
                 for (final Map.Entry<String,Map<String, MutableStorageRecord>> context : contextMap.entrySet()) {
-                    gen.writeStartObject(context.getKey());
-                    for (Map.Entry<String,MutableStorageRecord> entry : context.getValue().entrySet()) {
-                        final MutableStorageRecord record = entry.getValue();
-                        final Long recexp = record.getExpiration();
-                        if (recexp == null || recexp > now) {
-                            empty = false;
-                            gen.writeStartObject(entry.getKey())
-                                .write("v", record.getValue());
-                            if (recexp != null) {
-                                gen.write("x", record.getExpiration());
-                                exp = Math.max(exp, recexp);
+                    if (!context.getValue().isEmpty()) {
+                        gen.writeStartObject(context.getKey());
+                        for (final Map.Entry<String,MutableStorageRecord> entry : context.getValue().entrySet()) {
+                            final MutableStorageRecord record = entry.getValue();
+                            final Long recexp = record.getExpiration();
+                            if (recexp == null || recexp > now) {
+                                empty = false;
+                                gen.writeStartObject(entry.getKey())
+                                    .write("v", record.getValue());
+                                if (recexp != null) {
+                                    gen.write("x", record.getExpiration());
+                                    exp = Math.max(exp, recexp);
+                                }
+                                gen.writeEnd();
                             }
-                            gen.writeEnd();
                         }
+                        gen.writeEnd();
                     }
-                    gen.writeEnd();
                 }
                 gen.writeEnd().close();
 



More information about the commits mailing list