Correction on StringBuilder default init size

Motivation:
The default StringBuilder size is too small (data.length + 4) while it will be 2*data.length (byte to Hex) + 5 "-" char (since 5 peaces appended).

Modification:
Changing initial size to the correct one

Result:
Allocation of the correct final size from the beginning for this StringBuilder.
This commit is contained in:
Frédéric Brégier 2014-05-22 09:15:20 +02:00 committed by Norman Maurer
parent ea0eb4fdab
commit e1abfbb6c1

View File

@ -423,7 +423,7 @@ final class DefaultChannelId implements ChannelId {
}
private String newLongValue() {
StringBuilder buf = new StringBuilder(data.length + 4);
StringBuilder buf = new StringBuilder(2 * data.length + 5);
int i = 0;
i = appendHexDumpField(buf, i, MACHINE_ID_LEN);
i = appendHexDumpField(buf, i, PROCESS_ID_LEN);