aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/util
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2014-03-24 10:35:14 +0200
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2014-03-24 10:35:14 +0200
commit1cc5494e9adf6fb25acfa69cfa1e586866549b9a (patch)
treee035169543d0f28d4c4ad0abab27556372adc09e /src/net/java/sip/communicator/util
parentf5cb93e794fa5e5f78baa29f9b185d703b14f9e5 (diff)
downloadjitsi-1cc5494e9adf6fb25acfa69cfa1e586866549b9a.zip
jitsi-1cc5494e9adf6fb25acfa69cfa1e586866549b9a.tar.gz
jitsi-1cc5494e9adf6fb25acfa69cfa1e586866549b9a.tar.bz2
Fixes a failure to take into account the user's preference with respect to utilized port ranges in XMPP calls. Reported by Mitchell Langs.
Diffstat (limited to 'src/net/java/sip/communicator/util')
-rw-r--r--src/net/java/sip/communicator/util/PortTracker.java37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/net/java/sip/communicator/util/PortTracker.java b/src/net/java/sip/communicator/util/PortTracker.java
index 9b6fda5..1adf134 100644
--- a/src/net/java/sip/communicator/util/PortTracker.java
+++ b/src/net/java/sip/communicator/util/PortTracker.java
@@ -77,13 +77,13 @@ public class PortTracker
throws IllegalArgumentException
{
//validate
- if( !NetworkUtils.isValidPortNumber(newMinPort)
- || !NetworkUtils.isValidPortNumber(newMaxPort)
- || newMaxPort < newMinPort)
+ if((newMaxPort < newMinPort)
+ || !NetworkUtils.isValidPortNumber(newMinPort)
+ || !NetworkUtils.isValidPortNumber(newMaxPort))
{
throw new IllegalArgumentException(
- "[" + newMinPort + " to "
- + newMaxPort + "] is not a valid port range.");
+ "[" + newMinPort + ", " + newMaxPort
+ + "] is not a valid port range.");
}
//reset bounds
@@ -95,9 +95,7 @@ public class PortTracker
* if already valid.
*/
if (port < minPort || port > maxPort)
- {
port = minPort;
- }
}
/**
@@ -106,25 +104,24 @@ public class PortTracker
* this method will simply return without an exception and without an impact
* on the state of this class.
*
- * @param newMinPortString the minimum port that we would like to bind on
- * @param newMaxPortString the maximum port that we would like to bind on
+ * @param newMinPort the minimum port that we would like to bind on
+ * @param newMaxPort the maximum port that we would like to bind on
*/
- public void tryRange(String newMinPortString, String newMaxPortString)
+ public void tryRange(String newMinPort, String newMaxPort)
{
try
{
- int newMinPort = Integer.parseInt(newMinPortString);
- int newMaxPort = Integer.parseInt(newMaxPortString);
-
- setRange(newMinPort, newMaxPort);
+ setRange(
+ Integer.parseInt(newMinPort),
+ Integer.parseInt(newMaxPort));
}
- catch(Exception exc)//Null, NumberFormat, IllegalArgument
+ catch(Exception e)//Null, NumberFormat, IllegalArgument
{
- logger.info("Ignoring invalid port range ["+ newMinPortString
- + " to " + newMaxPortString +"]");
-
-
- logger.debug("Cause: ", exc);
+ logger.info(
+ "Ignoring invalid port range [" + newMinPort + ", "
+ + newMaxPort + "]");
+ if (logger.isDebugEnabled())
+ logger.debug("Cause: ", e);
}
}