Skip to content

Commit

Permalink
Using StringBuilder instead of concatenating Strings
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Oct 31, 2021
1 parent 8a6da3b commit ebb18f0
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,30 +575,30 @@ public void handle(AsyncResult<Void> event) {
private static void setHttpServerTiming(InsecureRequests insecureRequests, HttpServerOptions httpServerOptions,
HttpServerOptions sslConfig,
HttpServerOptions domainSocketOptions, boolean auxiliaryApplication) {
String serverListeningMessage = "Listening on: ";
StringBuilder serverListeningMessage = new StringBuilder("Listening on: ");
int socketCount = 0;

if (httpServerOptions != null && !InsecureRequests.DISABLED.equals(insecureRequests)) {
serverListeningMessage += String.format(
"http://%s:%s", httpServerOptions.getHost(), actualHttpPort);
serverListeningMessage.append(String.format(
"http://%s:%s", httpServerOptions.getHost(), actualHttpPort));
socketCount++;
}

if (sslConfig != null) {
if (socketCount > 0) {
serverListeningMessage += " and ";
serverListeningMessage.append(" and ");
}
serverListeningMessage += String.format("https://%s:%s", sslConfig.getHost(), actualHttpsPort);
serverListeningMessage.append(String.format("https://%s:%s", sslConfig.getHost(), actualHttpsPort));
socketCount++;
}

if (domainSocketOptions != null) {
if (socketCount > 0) {
serverListeningMessage += " and ";
serverListeningMessage.append(" and ");
}
serverListeningMessage += String.format("unix:%s", domainSocketOptions.getHost());
serverListeningMessage.append(String.format("unix:%s", domainSocketOptions.getHost()));
}
Timing.setHttpServer(serverListeningMessage, auxiliaryApplication);
Timing.setHttpServer(serverListeningMessage.toString(), auxiliaryApplication);
}

/**
Expand Down

0 comments on commit ebb18f0

Please sign in to comment.