1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

SMACK-225 Converted abstract class to interface, added missing hashcode method, fixed typos and some minor name changes and added licensing text

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13600 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2013-04-01 13:40:02 +00:00
parent 0a1e72bb5f
commit 9da54ecbce
7 changed files with 81 additions and 23 deletions

View file

@ -23,10 +23,10 @@ public class HostAddress {
/**
* Creates a new HostAddress with the given FQDN. The port will be set to the default XMPP client port: 5222
*
* @param fqdn
* @throws IllegalArgumentException
* @param fqdn Fully qualified domain name.
* @throws IllegalArgumentException If the fqdn is null.
*/
public HostAddress(String fqdn) throws IllegalArgumentException {
public HostAddress(String fqdn) {
if (fqdn == null)
throw new IllegalArgumentException("FQDN is null");
if (fqdn.charAt(fqdn.length() - 1) == '.') {
@ -39,7 +39,14 @@ public class HostAddress {
this.port = 5222;
}
public HostAddress(String fqdn, int port) throws IllegalArgumentException {
/**
* Creates a new HostAddress with the given FQDN. The port will be set to the default XMPP client port: 5222
*
* @param fqdn Fully qualified domain name.
* @param port The port to connect on.
* @throws IllegalArgumentException If the fqdn is null or port is out of valid range (0 - 65535).
*/
public HostAddress(String fqdn, int port) {
this(fqdn);
if (port < 0 || port > 65535)
throw new IllegalArgumentException(
@ -60,10 +67,12 @@ public class HostAddress {
this.exception = e;
}
@Override
public String toString() {
return fqdn + ":" + port;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
@ -80,6 +89,13 @@ public class HostAddress {
return port == address.port;
}
@Override
public int hashCode() {
int result = 1;
result = 37 * result + fqdn.hashCode();
return result * 37 + port;
}
public String getErrorMessage() {
String error;
if (exception == null) {