From 2d9ccc7752c70a4f8143b9d6ff48692ff4d00379 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Fri, 27 Sep 2024 21:38:42 +0300 Subject: [PATCH] Fix reliability issues --- .../main/java/com/microsoft/kiota/http/KiotaClientFactory.java | 3 +++ .../microsoft/kiota/http/middleware/AuthorizationHandler.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/KiotaClientFactory.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/KiotaClientFactory.java index a141b6f0b..68aa51bc1 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/KiotaClientFactory.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/KiotaClientFactory.java @@ -59,6 +59,9 @@ private KiotaClientFactory() {} * @return an OkHttpClient Builder instance. */ @Nonnull public static OkHttpClient.Builder create(@Nullable final List interceptors) { + if (interceptors == null) { + return create(); + } return create( (new ArrayList<>(interceptors)).toArray(new Interceptor[interceptors.size()])); } diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/AuthorizationHandler.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/AuthorizationHandler.java index 2f45c325f..7485e253c 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/AuthorizationHandler.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/AuthorizationHandler.java @@ -87,7 +87,8 @@ public AuthorizationHandler( return response; } - span.addEvent("com.microsoft.kiota.handler.authorization.challenge_received"); + if (span != null) + span.addEvent("com.microsoft.kiota.handler.authorization.challenge_received"); // We cannot replay one-shot requests after claims challenge final RequestBody requestBody = request.body();