am acf64935: Merge "Check port in create peer\'s SIP profile." into gingerbread

* commit 'acf649356b1ab25098277018b5d76f55f9ef660b':
  Check port in create peer's SIP profile.
This commit is contained in:
Hung-ying Tyan
2010-12-20 11:29:52 -08:00
committed by Android Git Automerger
2 changed files with 7 additions and 5 deletions

View File

@@ -177,7 +177,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
*/ */
public Builder setPort(int port) throws IllegalArgumentException { public Builder setPort(int port) throws IllegalArgumentException {
if ((port > 65535) || (port < 1000)) { if ((port > 65535) || (port < 1000)) {
throw new IllegalArgumentException("incorrect port arugment"); throw new IllegalArgumentException("incorrect port arugment: " + port);
} }
mProfile.mPort = port; mProfile.mPort = port;
return this; return this;

View File

@@ -1333,10 +1333,12 @@ class SipSessionGroup implements SipListener {
SipURI uri = (SipURI) address.getURI(); SipURI uri = (SipURI) address.getURI();
String username = uri.getUser(); String username = uri.getUser();
if (username == null) username = ANONYMOUS; if (username == null) username = ANONYMOUS;
return new SipProfile.Builder(username, uri.getHost()) int port = uri.getPort();
.setPort(uri.getPort()) SipProfile.Builder builder =
.setDisplayName(address.getDisplayName()) new SipProfile.Builder(username, uri.getHost())
.build(); .setDisplayName(address.getDisplayName());
if (port > 0) builder.setPort(port);
return builder.build();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new SipException("createPeerProfile()", e); throw new SipException("createPeerProfile()", e);
} catch (ParseException e) { } catch (ParseException e) {