[findBugs] Fix calculation of host header in SignerV4

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>
This commit is contained in:
Matthias Sohn 2016-05-19 14:50:12 +02:00
parent bf15a72ea0
commit c54ff8bf12
1 changed files with 3 additions and 3 deletions

View File

@ -229,12 +229,12 @@ private static String formatAuthorizationHeader(
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(