Buggy code:
final class HttpServletResponseFacade implements HttpServletResponse { private static StringManager sm = StringManager . getManager ( "org.apache.tomcat.resources" ) ; private Response response ; private boolean usingStream = false ; private boolean usingWriter = false ; ServletOutputStreamFacade osFacade = null ; PrintWriter writer = null ; HttpServletResponseFacade ( Response response ) { } void recycle ( ) { } public void addCookie ( Cookie cookie ) { } public boolean containsHeader ( String name ) { } public String encodeRedirectURL ( String location ) { } public String encodeRedirectUrl ( String location ) { } public String encodeURL ( String url ) { } public String encodeUrl ( String url ) { } public String getCharacterEncoding ( ) { } public ServletOutputStream getOutputStream ( ) throws IOException { } public PrintWriter getWriter ( ) throws IOException { } public void sendError ( int sc ) throws IOException { } public void sendError ( int sc , String msg ) throws IOException { } public void sendRedirect ( String location ) throws IOException , IllegalArgumentException { } public void setContentLength ( int len ) { } public void setContentType ( String type ) { } public void setDateHeader ( String name , long date ) { } public void addDateHeader ( String name , long value ) { } public void setHeader ( String name , String value ) { } public void addHeader ( String name , String value ) { } public void setIntHeader ( String name , int value ) { } public void addIntHeader ( String name , int value ) { } public void setStatus ( int sc ) { } public void setBufferSize ( int size ) throws IllegalStateException { } public int getBufferSize ( ) { } public void reset ( ) throws IllegalStateException { } public boolean isCommitted ( ) { } public void flushBuffer ( ) throws IOException { } public void setLocale ( Locale loc ) { } public Locale getLocale ( ) { } public void setStatus ( int sc , String msg ) { } private boolean isEncodeable ( String location ) { Request request = response . getRequest ( ) ; HttpServletRequestFacade reqF = ( ( HttpServletRequestFacade ) ( request . getFacade ( ) ) ) ; if ( ! ( reqF . isRequestedSessionIdValid ( ) ) ) return false ; if ( reqF . isRequestedSessionIdFromCookie ( ) ) return false ; URL url = null ; try { url = new URL ( location ) ; } catch ( MalformedURLException e ) { return false ; } if ( ! ( request . scheme ( ) . equalsIgnoreCase ( url . getProtocol ( ) ) ) ) return false ; <START_BUG> if ( ! ( request . getServerName ( ) . equalsIgnoreCase ( url . getHost ( ) ) ) ) <END_BUG> return false ; int urlPort = url . getPort ( ) ; if ( urlPort == ( - 1 ) ) { urlPort = 80 ; } int serverPort = request . getServerPort ( ) ; if ( serverPort == ( - 1 ) ) serverPort = 80 ; if ( serverPort != urlPort ) return false ; String contextPath = request . getContext ( ) . getPath ( ) ; if ( ( contextPath != null ) && ( ( contextPath . length ( ) ) > 0 ) ) { String file = url . getFile ( ) ; if ( ( file == null ) || ( ! ( file . startsWith ( contextPath ) ) ) ) return false ; } return true ; } private String toAbsolute ( String location ) { } private String toEncoded ( String url , String sessionId ) { } private void cookie2serverCookie ( Cookie cookie , ServerCookie sc ) { } }

Fix:
if ( ! ( request . serverName ( ) . equalsIgnoreCase ( url . getHost ( ) ) ) )