X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=blobdiff_plain;f=org.argeo.enterprise%2Fsrc%2Forg%2Fargeo%2Fnaming%2FSrvRecord.java;h=8ecc9445790a1bcc32394e46f40484c18552b5f1;hp=d3515889a2988cc8d8dc5d6dba076e3360b3379f;hb=73a89e099608a51d9aef814a3f85a62947275f59;hpb=74f72bbc096ebb431686d1e93dd864dd00ab5ca5 diff --git a/org.argeo.enterprise/src/org/argeo/naming/SrvRecord.java b/org.argeo.enterprise/src/org/argeo/naming/SrvRecord.java index d3515889a..8ecc94457 100644 --- a/org.argeo.enterprise/src/org/argeo/naming/SrvRecord.java +++ b/org.argeo.enterprise/src/org/argeo/naming/SrvRecord.java @@ -20,10 +20,10 @@ class SrvRecord implements Comparable { return priority - other.priority; if (weight != other.weight) return other.weight - other.weight; - String host = toHost(); - String otherHost = other.toHost(); + String host = toHost(false); + String otherHost = other.toHost(false); if (host.length() == otherHost.length()) - return toHost().compareTo(other.toHost()); + return host.compareTo(otherHost); else return host.length() - otherHost.length(); } @@ -43,10 +43,10 @@ class SrvRecord implements Comparable { return priority + " " + weight; } - public String toHost() { + public String toHost(boolean withPort) { String hostStr = hostname; if (hostname.charAt(hostname.length() - 1) == '.') hostStr = hostname.substring(0, hostname.length() - 1); - return hostStr + ":" + port; + return hostStr + (withPort ? ":" + port : ""); } }