Revision: 61fccc5b3319
Author:   Jean Deruelle <[email protected]>
Date:     Wed Nov  6 00:11:00 2013 UTC
Log:      Update issue 236

(cherry picked from telscale commit fd8ec2be4bf9fbe27c997beda885fdaa83632463)

Conflicts:
        .classpath

http://code.google.com/p/jain-sip/source/detail?r=61fccc5b3319&repo=ext

Modified:
 /.classpath
 /src/main/java/org/mobicents/ext/javax/sip/dns/DefaultDNSServerLocator.java
 /src/test/java/org/mobicents/ext/javax/sip/dns/DNSServerLocatorTest.java

=======================================
--- /.classpath Thu Jan 31 14:16:08 2013 UTC
+++ /.classpath Wed Nov  6 00:11:00 2013 UTC
@@ -1,18 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.8.2/junit-4.8.2.jar"/> <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/> <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
        <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/jain-sip"/>
<classpathentry kind="var" path="M2_REPO/javax/sip/jain-sip-api/1.2.0/jain-sip-api-1.2.0.jar" sourcepath="M2_REPO/javax/sip/jain-sip-api/1.2.0/jain-sip-api-1.2.0-sources.jar">
                <attributes>
<attribute name="javadoc_location" value="jar:file:/home/jean/.m2/repository/javax/sip/jain-sip-api/1.2.0/jain-sip-api-1.2.0-javadoc.jar!/"/>
                </attributes>
        </classpathentry>
<classpathentry kind="var" path="M2_REPO/dnsjava/dnsjava/2.1.0/dnsjava-2.1.0.jar" sourcepath="M2_REPO/dnsjava/dnsjava/2.1.0/dnsjava-2.1.0-sources.jar"/>
-       <classpathentry kind="var" 
path="M2_REPO/junit/junit/4.1/junit-4.1.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/> <classpathentry kind="var" path="M2_REPO/org/mockito/mockito-all/1.8.5/mockito-all-1.8.5.jar" sourcepath="M2_REPO/org/mockito/mockito-all/1.8.5/mockito-all-1.8.5-sources.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-       <classpathentry combineaccessrules="false" kind="src" path="/jain-sip"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
=======================================
--- /src/main/java/org/mobicents/ext/javax/sip/dns/DefaultDNSServerLocator.java Fri Mar 9 22:12:11 2012 UTC +++ /src/main/java/org/mobicents/ext/javax/sip/dns/DefaultDNSServerLocator.java Wed Nov 6 00:11:00 2013 UTC
@@ -1,23 +1,20 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2013, Telestax Inc and individual contributors
+ * by the @authors tag.
  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
  */

 package org.mobicents.ext.javax.sip.dns;
@@ -103,7 +100,12 @@
                if(uri instanceof TelURL) {
                        return lookupSipUri(((TelURL)uri).getPhoneNumber());
} else if(uri.isSipURI() && ((SipURI)uri).getParameter("user") != null && ((SipURI)uri).getParameter("user").equalsIgnoreCase("phone")) {
-                       return lookupSipUri(((SipURI)uri).getUser());
+                   String phoneNumber = ((SipURI)uri).getUser();
+                   if(phoneNumber == null || phoneNumber.isEmpty()) {
+                       // 
https://code.google.com/p/sipservlets/issues/detail?id=236
+ throw new IllegalArgumentException("Phone Number can't be empty in following uri with phone parameter " + uri);
+               }
+                       return lookupSipUri(phoneNumber);
                } else if (uri instanceof SipURI) {
                        return (SipURI) uri;
                }
=======================================
--- /src/test/java/org/mobicents/ext/javax/sip/dns/DNSServerLocatorTest.java Fri Mar 9 17:32:28 2012 UTC +++ /src/test/java/org/mobicents/ext/javax/sip/dns/DNSServerLocatorTest.java Wed Nov 6 00:11:00 2013 UTC
@@ -1,23 +1,20 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2013, Telestax Inc and individual contributors
+ * by the @authors tag.
  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
  */

 package org.mobicents.ext.javax.sip.dns;
@@ -105,6 +102,28 @@
                assertNotNull(hops);
                assertTrue(hops.size() > 0);
        }
+
+       @Test
+       // https://code.google.com/p/sipservlets/issues/detail?id=236
+    public void testResolveBadPhoneNumber() throws ParseException {
+        String transport = ListeningPoint.UDP;
+        int port = 5080;
+
+ DNSLookupPerformer dnsLookupPerformer = mock(DefaultDNSLookupPerformer.class);
+        dnsServerLocator.setDnsLookupPerformer(dnsLookupPerformer);
+        LinkedList<Hop> mockedHops = new LinkedList<Hop>();
+        mockedHops.add(new HopImpl(LOCALHOST, port, transport));
+ when(dnsLookupPerformer.locateHopsForNonNumericAddressWithPort(host, port, transport.toLowerCase())).thenReturn(mockedHops);
+
+        sipURI = addressFactory.createSipURI(null,host);
+        sipURI.setParameter("user", "phone");
+        try {
+            SipURI result = dnsServerLocator.getSipURI(sipURI);
+ fail("IllegalArgumentException should be thrown is there is not user part for an uri with a phone parameter");
+        } catch (IllegalArgumentException e) {
+
+        }
+    }

        @Test
        public void testResolveHostByAandAAAALookup() throws ParseException {

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to