We ignored the returned concatenation of host name and port number. Fix
this and use a StringBuilder to avoid creation of unnecessary String
objects.
Change-Id: I61fac639d4a4c95412eb41a0f9131d0c38aca794
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
private static void addHostHeader(URL url,
Map<String, String> headers) {
- String hostHeader = url.getHost();
+ StringBuilder hostHeader = new StringBuilder(url.getHost());
int port = url.getPort();
if (port > -1) {
- hostHeader.concat(":" + Integer.toString(port)); //$NON-NLS-1$
+ hostHeader.append(":").append(port); //$NON-NLS-1$
}
- headers.put("Host", hostHeader); //$NON-NLS-1$
+ headers.put("Host", hostHeader.toString()); //$NON-NLS-1$
}
private static String canonicalizeHeaderNames(