fix: avoid a meteor hit NullPointerException
There could be no cookies when we try to iterate over them as the
contract for `HttpServletRequest::getCookies` states that `null` is
returned in that case. This cannot happen in Syndesis as there is at
least the OAuth proxy cookies, but best be careful about this.
@@ -158,7 +158,12 @@ public class CredentialHandler {
static void removeCredentialCookies(final HttpServletRequest request,
final HttpServletResponse response) {
- Arrays.stream(request.getCookies()).filter(c -> c.getName().startsWith(CredentialFlowState.CREDENTIAL_PREFIX))
+ final Cookie[] cookies = request.getCookies();
+ if (cookies == null) {
+ return;
+ }
+
+ Arrays.stream(cookies).filter(c -> c.getName().startsWith(CredentialFlowState.CREDENTIAL_PREFIX))
.forEach(c -> {
final Cookie removal = new Cookie(c.getName(), "");
removal.setPath("/");
