Fix sorting of SSH help text

Commands were displaying in random order, based on how they
appear in the ConcurrentHashMap. Sort commands before output.

Change-Id: Ie4fdf4d7e02d35385b3c065da2e895ab0c7225d9
This commit is contained in:
Shawn O. Pearce
2012-05-11 15:04:21 -07:00
parent 7f4fbc8756
commit 9a59b7b27a

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.sshd;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Atomics;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.account.CapabilityControl;
@@ -134,9 +135,9 @@ final class DispatchCommand extends BaseCommand {
}
usage.append(" are:\n");
usage.append("\n");
for (Map.Entry<String, Provider<Command>> e : commands.entrySet()) {
for (String name : Sets.newTreeSet(commands.keySet())) {
usage.append(" ");
usage.append(e.getKey());
usage.append(name);
usage.append("\n");
}
usage.append("\n");