From ce4691f13db8ac9514ba45becdb8db9bc276db84 Mon Sep 17 00:00:00 2001 From: Anuved Verma Date: Tue, 2 Jul 2024 09:15:58 -0700 Subject: [PATCH] fix --- .../lyft/data/proxyserver/ProxyHandler.java | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java index bf09b71b..d8479e57 100644 --- a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java +++ b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java @@ -74,35 +74,25 @@ protected void postConnectionHook( + " servlet path {} , toString {}, size {}", request.getRequestURL(), request.getRequestURI(), request.getServletPath(), request.toString(), request.getContentLength(), var9); - String requestHeaderLog = getErrorLogHeaders(request); - log.error(requestHeaderLog); - - String responseHeaderLog = getErrorLogHeaders(response); - log.error(responseHeaderLog); + errorLogHeaders(request); + errorLogHeaders(response);; callback.failed(var9); } } - protected String getErrorLogHeaders(HttpServletRequest request) { - StringBuilder sb = new StringBuilder(); - sb.append("------- error HttpServletRequest headers---------\n"); + protected void errorLogHeaders(HttpServletRequest request) { + log.error("------- error HttpServletResponse headers---------"); Enumeration headers = request.getHeaderNames(); - while (headers.hasMoreElements()) { - String header = headers.nextElement(); - sb.append(header).append("->").append(request.getHeader(header)).append("\n"); + for (String header : headers) { + log.error(header + "->" + request.getHeader(header)); + } } + + protected void errorLogHeaders(HttpServletResponse response) { + log.error("------- error HttpServletResponse headers---------"); + Collection headers = response.getHeaderNames(); + for (String header : headers) { + log.error(header + "->" + response.getHeader(header)); } - return sb.toString(); - } - - protected String getErrorLogHeaders(HttpServletResponse response) { - StringBuilder sb = new StringBuilder(); - sb.append("------- error HttpServletResponse headers---------\n"); - Enumeration headers = response.getHeaderNames(); - while (headers.hasMoreElements()) { - String header = headers.nextElement(); - sb.append(header).append("->").append(response.getHeader(header)).append("\n"); - } - return sb.toString(); } protected void debugLogHeaders(HttpServletRequest request) { @@ -125,7 +115,6 @@ protected void debugLogHeaders(HttpServletResponse response) { } } } - protected void debugLogHeaders(Request proxyRequest) { if (log.isDebugEnabled()) { log.debug("-------Request proxyRequest headers---------");