From 24d3d19a9e5727a57fbcdbb243ead005506b4dc5 Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Sun, 7 Jun 2020 18:19:03 +0200 Subject: [PATCH] [nest] Fix possible memory leak and communication problems (#7871) It is possible the NestStreamingRequestFilter adds multiple of the same headers which may result in a memory leak and communication problems. This is the same fix as added in #7811 for OH3 with CXF. Signed-off-by: Wouter Born --- .../nest/internal/rest/NestStreamingRequestFilter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.nest/src/main/java/org/openhab/binding/nest/internal/rest/NestStreamingRequestFilter.java b/bundles/org.openhab.binding.nest/src/main/java/org/openhab/binding/nest/internal/rest/NestStreamingRequestFilter.java index d18312c1fc283..80b6c17bc6a44 100644 --- a/bundles/org.openhab.binding.nest/src/main/java/org/openhab/binding/nest/internal/rest/NestStreamingRequestFilter.java +++ b/bundles/org.openhab.binding.nest/src/main/java/org/openhab/binding/nest/internal/rest/NestStreamingRequestFilter.java @@ -40,8 +40,8 @@ public NestStreamingRequestFilter(String accessToken) { public void filter(@Nullable ClientRequestContext requestContext) throws IOException { if (requestContext != null) { MultivaluedMap headers = requestContext.getHeaders(); - headers.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); - headers.add(HttpHeaders.CACHE_CONTROL, "no-cache"); + headers.putSingle(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); + headers.putSingle(HttpHeaders.CACHE_CONTROL, "no-cache"); } } }