very there are cookies
avoid NullPpointerException when there are no cookies in the request.
@@ -325,7 +325,9 @@ public abstract class SecurityRealm extends AbstractDescribableImpl<SecurityReal
* responsibility not to send them to us in the first place.
*/
final String cookieName = "JSESSIONID.";
- for (Cookie cookie : req.getCookies()) {
+ Cookie[] cookies = req.getCookies();
+ if (cookies != null) {
+ for (Cookie cookie : cookies) {
if (cookie.getName().startsWith(cookieName)) {
LOGGER.log(Level.FINE, "Removing cookie {0} during logout", cookie.getName());
// one reason users log out is to clear their session(s)
@@ -336,6 +338,7 @@ public abstract class SecurityRealm extends AbstractDescribableImpl<SecurityReal
}
}
}
+ }
/**
* Returns true if this {@link SecurityRealm} allows online sign-up.
