SMACK-283 Changed the STUNResolver to not use a default server. Thus causing it to fail to initialize if no server is actually configured.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@12106 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2011-03-14 01:04:40 +00:00
parent f21ae88344
commit 67a5e6b98d
1 changed files with 6 additions and 17 deletions

View File

@ -52,11 +52,6 @@ public class STUNResolver extends TransportResolver {
// The filename where the STUN servers are stored. // The filename where the STUN servers are stored.
public final static String STUNSERVERS_FILENAME = "META-INF/stun-config.xml"; public final static String STUNSERVERS_FILENAME = "META-INF/stun-config.xml";
// Fallback values when we don't have any STUN server to use...
private final static String FALLBACKHOSTNAME = "stun.xten.net";
private final static int FALLBACKHOSTPORT = 3478;
// Current STUN server we are using // Current STUN server we are using
protected STUNService currentServer; protected STUNService currentServer;
@ -189,10 +184,10 @@ public class STUNResolver extends TransportResolver {
} }
catch (XmlPullParserException e) { catch (XmlPullParserException e) {
e.printStackTrace(); LOGGER.error(e.getMessage(), e);
} }
catch (IOException e) { catch (IOException e) {
e.printStackTrace(); LOGGER.error(e.getMessage(), e);
} }
currentServer = bestSTUNServer(serversList); currentServer = bestSTUNServer(serversList);
@ -247,13 +242,7 @@ public class STUNResolver extends TransportResolver {
} }
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); LOGGER.error(e.getMessage(), e);
}
// If the list of candidates is empty, add at least one default server
if (serversList.isEmpty()) {
currentServer = new STUNService(FALLBACKHOSTNAME, FALLBACKHOSTPORT);
serversList.add(currentServer);
} }
return serversList; return serversList;
@ -370,14 +359,14 @@ public class STUNResolver extends TransportResolver {
} }
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); LOGGER.error(e.getMessage(), e);
} }
} }
} }
} }
} }
catch (SocketException e) { catch (SocketException e) {
e.printStackTrace(); LOGGER.error(e.getMessage(), e);
} }
finally { finally {
setInitialized(); setInitialized();
@ -524,7 +513,7 @@ public class STUNResolver extends TransportResolver {
} }
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); LOGGER.error(e.getMessage(), e);
} }
return result; return result;