From e4eada63e4e38be8b50167a5cef9193995ba6e61 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sun, 13 Aug 2023 13:31:10 +0200 Subject: [PATCH] Fixed potential NPE in DigestScheme --- .../org/apache/hc/client5/http/impl/auth/DigestScheme.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/DigestScheme.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/DigestScheme.java index 62a21002b..e068999d9 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/DigestScheme.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/DigestScheme.java @@ -238,7 +238,9 @@ public class DigestScheme implements AuthScheme, Serializable { } private String createDigestResponse(final HttpRequest request) throws AuthenticationException { - + if (credentials == null) { + throw new AuthenticationException("User credentials have not been provided"); + } final String uri = request.getRequestUri(); final String method = request.getMethod(); final String realm = this.paramMap.get("realm");