This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 077c0c5c10ecc314dbcda60542a65a1b3439cef9 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri May 20 06:48:35 2022 +0100 Refactor for cleaner code and to avoid NPE warnings from IDE --- java/org/apache/catalina/connector/Response.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java index e0f320fe05..b38667061b 100644 --- a/java/org/apache/catalina/connector/Response.java +++ b/java/org/apache/catalina/connector/Response.java @@ -1362,18 +1362,17 @@ public class Response implements HttpServletResponse { // If no ROOT context is defined, the context can be null. // In this case, the default Tomcat values are assumed, but without // reference to org.apache.catalina.STRICT_SERVLET_COMPLIANCE. - boolean reqHasContext = (context != null); String locationUri; // Relative redirects require HTTP/1.1 if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() && - (!reqHasContext || context.getUseRelativeRedirects())) { + (context == null || context.getUseRelativeRedirects())) { locationUri = location; } else { locationUri = toAbsolute(location); } setStatus(status); setHeader("Location", locationUri); - if (reqHasContext && context.getSendRedirectBody()) { + if (context != null && context.getSendRedirectBody()) { PrintWriter writer = getWriter(); writer.print(sm.getString("coyoteResponse.sendRedirect.note", Escape.htmlElementContent(locationUri))); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org