Skip to content
Snippets Groups Projects
Commit 50e1c84c authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-22394: When accessing directly Tomcat, the resolved source URL can contain an extra port

* bulletproofing for tests
parent 32385182
No related branches found
No related tags found
No related merge requests found
...@@ -193,8 +193,9 @@ private static void appendHostPort(HttpServletRequest request, StringBuilder bui ...@@ -193,8 +193,9 @@ private static void appendHostPort(HttpServletRequest request, StringBuilder bui
// Ask the application server (we don't start with that because it's very often wrong or badly configured // Ask the application server (we don't start with that because it's very often wrong or badly configured
// behind an HTTP proxy...) // behind an HTTP proxy...)
String requestURLString = request.getRequestURL().toString(); StringBuffer buffer = request.getRequestURL();
if (!requestURLString.isEmpty()) { if (buffer != null && !buffer.isEmpty()) {
String requestURLString = buffer.toString();
try { try {
URL requestURL = new URL(requestURLString); URL requestURL = new URL(requestURLString);
builder.append(requestURL.getHost()); builder.append(requestURL.getHost());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment