geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r593290 - in /geronimo/specs/trunk/geronimo-javamail_1.4_spec/src: main/java/javax/mail/URLName.java test/java/javax/mail/URLNameTest.java
Date Thu, 08 Nov 2007 20:18:30 GMT
Author: rickmcguire
Date: Thu Nov  8 12:18:29 2007
New Revision: 593290

URL: http://svn.apache.org/viewvc?rev=593290&view=rev
Log:
GERONIMO-3593 URLName getFile() processing not consistent with reference version.


Modified:
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/URLName.java
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/URLNameTest.java

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/URLName.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/URLName.java?rev=593290&r1=593289&r2=593290&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/URLName.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/URLName.java
Thu Nov  8 12:18:29 2007
@@ -71,6 +71,13 @@
         host = checkBlank(uri.getHost());
         port = uri.getPort();
         file = checkBlank(uri.getPath());
+        // if the file starts with "/", we need to strip that off. 
+        // URL and URLName do not have the same behavior when it comes 
+        // to keeping that there. 
+        if (file != null && file.length() > 1 && file.startsWith("/"))
{
+            file = checkBlank(file.substring(1)); 
+        }
+        
         ref = checkBlank(uri.getFragment());
         String userInfo = checkBlank(uri.getUserInfo());
         if (userInfo == null) {
@@ -167,7 +174,7 @@
                     buf.append(':').append(port);
                 }
                 if (file != null) {
-                    buf.append(file);
+                    buf.append('/').append(file);
                 }
                 hashCode = buf.toString().hashCode();
                 if (ref != null) {

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/URLNameTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/URLNameTest.java?rev=593290&r1=593289&r2=593290&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/URLNameTest.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/URLNameTest.java
Thu Nov  8 12:18:29 2007
@@ -58,7 +58,7 @@
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/file1", name.getFile());
+        assertEquals("file/file1", name.getFile());
         assertEquals("ref", name.getRef());
         assertNull(name.getUsername());
         assertNull(name.getPassword());
@@ -74,7 +74,7 @@
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/", name.getFile());
+        assertEquals("file/", name.getFile());
         assertNull(name.getRef());
         assertNull(name.getUsername());
         assertNull(name.getPassword());
@@ -90,7 +90,7 @@
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/", name.getFile());
+        assertEquals("file/", name.getFile());
         assertNull(name.getRef());
         assertEquals("john", name.getUsername());
         assertNull(name.getPassword());
@@ -106,7 +106,7 @@
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/", name.getFile());
+        assertEquals("file/", name.getFile());
         assertNull(name.getRef());
         assertEquals("john", name.getUsername());
         assertEquals("doe", name.getPassword());
@@ -122,7 +122,7 @@
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/", name.getFile());
+        assertEquals("file/", name.getFile());
         assertNull(name.getRef());
         assertEquals("john@gmail.com", name.getUsername());
         assertEquals("doe", name.getPassword());
@@ -241,12 +241,12 @@
             fail();
         }
 
-        name = new URLName("http", "www.apache.org", -1, "/file/file2", "", "");
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "", "");
         assertEquals("http://www.apache.org/file/file2", name.toString());
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/file2", name.getFile());
+        assertEquals("file/file2", name.getFile());
         assertNull(name.getRef());
         assertNull(name.getUsername());
         assertNull(name.getPassword());
@@ -256,12 +256,12 @@
             fail();
         }
 
-        name = new URLName("http", "www.apache.org", -1, "/file/file2", "john", "");
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "john", "");
         assertEquals("http://john@www.apache.org/file/file2", name.toString());
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/file2", name.getFile());
+        assertEquals("file/file2", name.getFile());
         assertNull(name.getRef());
         assertEquals("john", name.getUsername());
         assertNull(name.getPassword());
@@ -271,12 +271,12 @@
             fail();
         }
 
-        name = new URLName("http", "www.apache.org", -1, "/file/file2", "john", "doe");
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "john", "doe");
         assertEquals("http://john:doe@www.apache.org/file/file2", name.toString());
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/file2", name.getFile());
+        assertEquals("file/file2", name.getFile());
         assertNull(name.getRef());
         assertEquals("john", name.getUsername());
         assertEquals("doe", name.getPassword());
@@ -286,12 +286,12 @@
             fail();
         }
 
-        name = new URLName("http", "www.apache.org", -1, "/file/file2", "john@gmail.com",
"doe");
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "john@gmail.com",
"doe");
         assertEquals("http://john%40gmail.com:doe@www.apache.org/file/file2", name.toString());
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/file2", name.getFile());
+        assertEquals("file/file2", name.getFile());
         assertNull(name.getRef());
         assertEquals("john@gmail.com", name.getUsername());
         assertEquals("doe", name.getPassword());
@@ -301,12 +301,12 @@
             fail();
         }
 
-        name = new URLName("http", "www.apache.org", -1, "/file/file2", "", "doe");
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "", "doe");
         assertEquals("http://www.apache.org/file/file2", name.toString());
         assertEquals("http", name.getProtocol());
         assertEquals("www.apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/file/file2", name.getFile());
+        assertEquals("file/file2", name.getFile());
         assertNull(name.getRef());
         assertNull(name.getUsername());
         assertNull(name.getPassword());
@@ -381,7 +381,7 @@
         assertEquals("foo", name.getProtocol());
         assertEquals("apache.org", name.getHost());
         assertEquals(-1, name.getPort());
-        assertEquals("/INBOX", name.getFile());
+        assertEquals("INBOX", name.getFile());
         assertNull(name.getRef());
         assertEquals("jdoe", name.getUsername());
         assertNull(name.getPassword());



Mime
View raw message