X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.enterprise%2Fsrc%2Forg%2Fargeo%2Fnaming%2FSrvRecord.java;fp=org.argeo.enterprise%2Fsrc%2Forg%2Fargeo%2Fnaming%2FSrvRecord.java;h=8ecc9445790a1bcc32394e46f40484c18552b5f1;hb=043d226a5504a212eb5673c3ed4441c1167724d7;hp=d3515889a2988cc8d8dc5d6dba076e3360b3379f;hpb=cdc0e2725f4ec174309c3fdcd060f80753210c00;p=lgpl%2Fargeo-commons.git 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 : ""); } }