This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 16fa5e03a13a16859569c93822efc5a852b4e57d 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 d0bdc3003e..4fdeb704a8 100644 --- a/java/org/apache/catalina/connector/Response.java +++ b/java/org/apache/catalina/connector/Response.java @@ -1328,18 +1328,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