fix(http-server): Additional null check to fix an issue in native-image
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
12aec5bfda
commit
c455aa42a8
|
@ -112,6 +112,8 @@ import java.util.zip.GZIPOutputStream;
|
||||||
* @since 2008-07-24
|
* @since 2008-07-24
|
||||||
*/
|
*/
|
||||||
public class JLHTTPServer {
|
public class JLHTTPServer {
|
||||||
|
private static final System.Logger LOGGER = System.getLogger("commons-http-server");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The SimpleDateFormat-compatible formats of dates which must be supported.
|
* The SimpleDateFormat-compatible formats of dates which must be supported.
|
||||||
* Note that all generated date fields must be in the RFC 1123 format only,
|
* Note that all generated date fields must be in the RFC 1123 format only,
|
||||||
|
@ -443,9 +445,10 @@ public class JLHTTPServer {
|
||||||
* or the default virtual host
|
* or the default virtual host
|
||||||
*/
|
*/
|
||||||
public VirtualHost getVirtualHost() {
|
public VirtualHost getVirtualHost() {
|
||||||
return host != null ? host
|
if (host != null) return host;
|
||||||
: (host = JLHTTPServer.this.getVirtualHost(getBaseURL().getHost())) != null ? host
|
URL baseUrl = getBaseURL();
|
||||||
: (host = JLHTTPServer.this.getVirtualHost(null));
|
if (baseUrl != null && (host = JLHTTPServer.this.getVirtualHost(baseUrl.getHost())) != null) return host;
|
||||||
|
return host = JLHTTPServer.this.getVirtualHost(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -981,6 +984,7 @@ public class JLHTTPServer {
|
||||||
resp = new Response(out); // ignore whatever headers may have already been set
|
resp = new Response(out); // ignore whatever headers may have already been set
|
||||||
resp.getHeaders().add("Connection", "close"); // about to close connection
|
resp.getHeaders().add("Connection", "close"); // about to close connection
|
||||||
resp.sendError(500, "Error processing request: " + t.getMessage());
|
resp.sendError(500, "Error processing request: " + t.getMessage());
|
||||||
|
LOGGER.log(System.Logger.Level.WARNING, "Error processing request", t);
|
||||||
} // otherwise just abort the connection since we can't recover
|
} // otherwise just abort the connection since we can't recover
|
||||||
break; // proceed to close connection
|
break; // proceed to close connection
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue