summaryrefslogtreecommitdiffstats
path: root/voip/java
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-12-16 16:13:29 +0800
committerHung-ying Tyan <tyanh@google.com>2010-12-16 20:27:57 +0800
commiteecf4a6f11129461088d620afadb6014edab3086 (patch)
treec628edbdf6ef2ff5141c1732572b4bf0c428388a /voip/java
parent4aedb39a49bda340f871c8fac2239de4fe549b03 (diff)
downloadframeworks_base-eecf4a6f11129461088d620afadb6014edab3086.zip
frameworks_base-eecf4a6f11129461088d620afadb6014edab3086.tar.gz
frameworks_base-eecf4a6f11129461088d620afadb6014edab3086.tar.bz2
Check port in create peer's SIP profile.
SipURI returns port -1 when port is not present in the URI. Don't call SipProfile.Builder.setPort() when that happens. Change-Id: Ic5fe7301195705a77010038cae20d6629b33135e
Diffstat (limited to 'voip/java')
-rw-r--r--voip/java/android/net/sip/SipProfile.java2
-rw-r--r--voip/java/com/android/server/sip/SipSessionGroup.java10
2 files changed, 7 insertions, 5 deletions
diff --git a/voip/java/android/net/sip/SipProfile.java b/voip/java/android/net/sip/SipProfile.java
index 4029ed0..f8fd2b7 100644
--- a/voip/java/android/net/sip/SipProfile.java
+++ b/voip/java/android/net/sip/SipProfile.java
@@ -177,7 +177,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
*/
public Builder setPort(int port) throws IllegalArgumentException {
if ((port > 65535) || (port < 1000)) {
- throw new IllegalArgumentException("incorrect port arugment");
+ throw new IllegalArgumentException("incorrect port arugment: " + port);
}
mProfile.mPort = port;
return this;
diff --git a/voip/java/com/android/server/sip/SipSessionGroup.java b/voip/java/com/android/server/sip/SipSessionGroup.java
index 30ddfb5..edf8b52 100644
--- a/voip/java/com/android/server/sip/SipSessionGroup.java
+++ b/voip/java/com/android/server/sip/SipSessionGroup.java
@@ -1333,10 +1333,12 @@ class SipSessionGroup implements SipListener {
SipURI uri = (SipURI) address.getURI();
String username = uri.getUser();
if (username == null) username = ANONYMOUS;
- return new SipProfile.Builder(username, uri.getHost())
- .setPort(uri.getPort())
- .setDisplayName(address.getDisplayName())
- .build();
+ int port = uri.getPort();
+ SipProfile.Builder builder =
+ new SipProfile.Builder(username, uri.getHost())
+ .setDisplayName(address.getDisplayName());
+ if (port > 0) builder.setPort(port);
+ return builder.build();
} catch (IllegalArgumentException e) {
throw new SipException("createPeerProfile()", e);
} catch (ParseException e) {