commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/provider/smb/test FileNameTestCase.java
Date Mon, 17 May 2004 18:22:17 GMT
imario      2004/05/17 11:22:17

  Modified:    vfs/src/java/org/apache/commons/vfs/provider
                        AbstractFileName.java
               vfs/src/test/org/apache/commons/vfs/provider/smb/test
                        FileNameTestCase.java
  Log:
  PR: 29007
  Submitted by:Anthony Goubard (adagoubard@chello.nl)
  
  do not treat filenames like .bashrc, /.java as extension.
  
  Revision  Changes    Path
  1.7       +7 -2      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileName.java
  
  Index: AbstractFileName.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileName.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractFileName.java	10 May 2004 20:09:42 -0000	1.6
  +++ AbstractFileName.java	17 May 2004 18:22:17 -0000	1.7
  @@ -328,7 +328,12 @@
           {
               getBaseName();
               final int pos = baseName.lastIndexOf('.');
  -            if ((pos == -1) || (pos == baseName.length() - 1))
  +            // if ((pos == -1) || (pos == baseName.length() - 1))
  +            // imario@ops.co.at: Review of patch from adagoubard@chello.nl
  +            // do not treat filenames like
  +            // .bashrc c:\windows\.java c:\windows\.javaws c:\windows\.jedit c:\windows\.appletviewer
  +            // as extension
  +            if ((pos < 1) || (pos == baseName.length() - 1))
               {
                   // No extension
                   extension = "";
  
  
  
  1.5       +29 -1     jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/provider/smb/test/FileNameTestCase.java
  
  Index: FileNameTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/provider/smb/test/FileNameTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileNameTestCase.java	10 May 2004 20:09:49 -0000	1.4
  +++ FileNameTestCase.java	17 May 2004 18:22:17 -0000	1.5
  @@ -81,6 +81,34 @@
           assertEquals("/file", name.getPath());
           assertEquals("smb://user@hostname/share/", name.getRootURI());
           assertEquals("smb://user@hostname/share/file", name.getURI());
  +
  +        // Name with extension
  +        name = SmbFileName.parseUri("smb://user@hostname/share/file.txt");
  +        assertEquals("smb", name.getScheme());
  +        assertEquals("user", name.getUserName());
  +        assertNull(name.getPassword());
  +        assertEquals("hostname", name.getHostName());
  +        assertEquals(139, name.getPort());
  +        assertEquals("share", name.getShare());
  +        assertEquals("/file.txt", name.getPath());
  +        assertEquals("file.txt", name.getBaseName());
  +        assertEquals("txt", name.getExtension());
  +        assertEquals("smb://user@hostname/share/", name.getRootURI());
  +        assertEquals("smb://user@hostname/share/file.txt", name.getURI());
  +
  +        // Name look likes extension, but isnt
  +        name = SmbFileName.parseUri("smb://user@hostname/share/.bashrc");
  +        assertEquals("smb", name.getScheme());
  +        assertEquals("user", name.getUserName());
  +        assertNull(name.getPassword());
  +        assertEquals("hostname", name.getHostName());
  +        assertEquals(139, name.getPort());
  +        assertEquals("share", name.getShare());
  +        assertEquals("/.bashrc", name.getPath());
  +        assertEquals(".bashrc", name.getBaseName());
  +        assertEquals("", name.getExtension());
  +        assertEquals("smb://user@hostname/share/", name.getRootURI());
  +        assertEquals("smb://user@hostname/share/.bashrc", name.getURI());
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message