[java-opensaml COMMIT] /trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStora...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Jul 18 21:05:49 EDT 2014
Author: scantor
Date: Fri Jul 18 21:05:49 2014
New Revision: 3972
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3972&view=rev
Log:
Tone down logging and treat expired data as a normal condition.
Modified:
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java
Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java?rev=3972&r1=3971&r2=3972&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java (original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java Fri Jul 18 21:05:49 2014
@@ -61,6 +61,7 @@
import net.shibboleth.utilities.java.support.net.CookieManager;
import net.shibboleth.utilities.java.support.net.URISupport;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
+import net.shibboleth.utilities.java.support.security.DataExpiredException;
import net.shibboleth.utilities.java.support.security.DataSealer;
import net.shibboleth.utilities.java.support.security.DataSealerException;
@@ -251,6 +252,7 @@
chain.doFilter(request, new OutputInterceptingHttpServletResponseProxy((HttpServletResponse) response));
}
+// Checkstyle: CyclomaticComplexity|MethodLength OFF
/**
* Reconstitute stored data.
*
@@ -258,7 +260,7 @@
*/
protected void load() throws IOException {
- Map<String,Map<String,MutableStorageRecord>> contextMap = getContextMap();
+ final Map<String,Map<String,MutableStorageRecord>> contextMap = getContextMap();
// Check for recursion. If load() is called directly, the above getter will
// call us, which means we need to short-circuit the "outer" load call by
@@ -272,12 +274,12 @@
setDirty(false);
// Search for our cookie.
- Cookie[] cookies = httpServletRequest.getCookies();
+ final Cookie[] cookies = httpServletRequest.getCookies();
if (cookies == null) {
return;
}
- Optional<Cookie> cookie = Iterables.tryFind(Arrays.asList(cookies), new Predicate<Cookie>() {
+ final Optional<Cookie> cookie = Iterables.tryFind(Arrays.asList(cookies), new Predicate<Cookie>() {
public boolean apply(@Nullable final Cookie c) {
return c != null && c.getName().equals(cookieName);
}
@@ -288,7 +290,7 @@
}
try {
- String decrypted = dataSealer.unwrap(URISupport.doURLDecode(cookie.get().getValue()));
+ final String decrypted = dataSealer.unwrap(URISupport.doURLDecode(cookie.get().getValue()));
log.trace("Data after decryption: {}", decrypted);
@@ -299,13 +301,13 @@
}
final JsonObject obj = (JsonObject) st;
- for (Map.Entry<String,JsonValue> context : obj.entrySet()) {
+ for (final Map.Entry<String,JsonValue> context : obj.entrySet()) {
if (context.getValue().getValueType() != JsonValue.ValueType.OBJECT) {
contextMap.clear();
throw new IOException("Found invalid data structure while parsing context map");
}
- JsonObject contextRecords = (JsonObject) context.getValue();
+ final JsonObject contextRecords = (JsonObject) context.getValue();
for (Map.Entry<String,JsonValue> record : contextRecords.entrySet()) {
final JsonObject fields = (JsonObject) record.getValue();
@@ -318,18 +320,24 @@
}
}
setDirty(false);
- } catch (NullPointerException | ClassCastException | ArithmeticException | JsonException e) {
+ } catch (final NullPointerException | ClassCastException | ArithmeticException | JsonException e) {
contextMap.clear();
setDirty(true);
log.error("Exception while parsing context map", e);
throw new IOException("Found invalid data structure while parsing context map", e);
- } catch (DataSealerException e) {
+ } catch (final DataExpiredException e) {
+ setDirty(true);
+ log.debug("Secured data expired");
+ return;
+ } catch (final DataSealerException e) {
setDirty(true);
log.error("Exception unwrapping secured data", e);
throw new IOException("Exception unwrapping secured data", e);
}
}
-
+// Checkstyle: CyclomaticComplexity|MethodLength ON
+
+// Checkstyle: CyclomaticComplexity OFF
/**
* Write/preserve stored data for subsequent requests.
*
[... 88 lines stripped ...]
More information about the commits
mailing list