On Tue, Oct 11, 2011 at 4:29 PM, sebb <seb...@gmail.com> wrote: > On 11 October 2011 21:27, Gary Gregory <garydgreg...@gmail.com> wrote: > > On Tue, Oct 11, 2011 at 3:54 PM, sebb <seb...@gmail.com> wrote: > > > >> On 11 October 2011 20:07, <ggreg...@apache.org> wrote: > >> > Author: ggregory > >> > Date: Tue Oct 11 19:07:08 2011 > >> > New Revision: 1182026 > >> > > >> > URL: http://svn.apache.org/viewvc?rev=1182026&view=rev > >> > Log: (empty) > >> > >> Why? > >> > > > > Please accept my appologies. I hit the wrong key, arg! > > > > This is for [VFS-367] Add APIs FileObject isFile(), FileObject > isFolder(), > > and FileName isFile() > > Can you update the log message please? > > In Eclipse, Show History, select the revision and the "Set Commit > Properties" >
Done! Thanks for the reminder. Gary > > > Gary > > > > > >> > >> If this is to fix a JIRA, it would be helpful to have the reference. > >> > >> > Modified: > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java > >> > > >> > > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java > >> > > >> > > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java > >> > > >> > > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java > >> > > >> > > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java > >> > > >> > > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/FileSystemManagerFactoryTestCase.java > >> > > >> > > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -332,6 +332,16 @@ public interface FileObject > >> > */ > >> > boolean isContentOpen(); > >> > > >> > + /** > >> > + * Checks if this file is a regular file. > >> > + * > >> > + * @return true if this file is a regular file. > >> > + * @throws FileSystemException if an error occurs. > >> > + * @see #getType() > >> > + * @see FileType#FILE > >> > + */ > >> > + public boolean isFile() throws FileSystemException; > >> > + > >> > > >> > // --- OPERATIONS -- > >> > /** > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -185,6 +185,11 @@ public class DecoratedFileObject impleme > >> > return decoratedFileObject.isContentOpen(); > >> > } > >> > > >> > + public boolean isFile() throws FileSystemException > >> > + { > >> > + return decoratedFileObject.isFile(); > >> > + } > >> > + > >> > @Override > >> > public String toString() > >> > { > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -510,6 +510,19 @@ public abstract class AbstractFileObject > >> > } > >> > > >> > /** > >> > + * Checks if this file is a regular file by using its file type. > >> > + * > >> > + * @return true if this file is a regular file. > >> > + * @throws FileSystemException > >> > + * @see #getType() > >> > + * @see FileType#FILE > >> > + */ > >> > + public boolean isFile() throws FileSystemException { > >> > + // Use equals instead of == to avoid any class loader > worries. > >> > + return FileType.FILE.equals(this.getType()); > >> > + } > >> > + > >> > + /** > >> > * Determines if this file can be read. > >> > * @return true if the file is a hidden file, false otherwise. > >> > * @throws FileSystemException if an error occurs. > >> > @@ -926,7 +939,7 @@ public abstract class AbstractFileObject > >> > { > >> > // VFS-210: We do not want to trunc any existing file, > >> checking for its existence is > >> > // still required > >> > - if (exists() && !FileType.FILE.equals(getType())) > >> > + if (exists() && !isFile()) > >> > { > >> > throw new > >> FileSystemException("vfs.provider/create-file.error", name); > >> > } > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -73,7 +73,7 @@ public class DefaultURLStreamHandler > >> > } > >> > else > >> > { > >> > - if (old.getType() == FileType.FILE && old.getParent() > != > >> null) > >> > + if (old.isFile() && old.getParent() != null) > >> > { > >> > // for files we have to resolve relative > >> > newURL = old.getParent().resolveFile(spec); > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -255,7 +255,7 @@ public class RamFileSystem extends Abstr > >> > this.toRamFileObject(child, root); > >> > } > >> > } > >> > - else if (fo.getType().equals(FileType.FILE)) > >> > + else if (fo.isFile()) > >> > { > >> > // Read bytes > >> > try > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -262,7 +262,7 @@ public class SftpFileObject extends Abst > >> > final ChannelSftp channel = fileSystem.getChannel(); > >> > try > >> > { > >> > - if (getType() == FileType.FILE) > >> > + if (isFile()) > >> > { > >> > channel.rm(relPath); > >> > } > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -279,7 +279,7 @@ public abstract class AbstractSyncTask > >> > final FileObject rootFile = srcs.get(i); > >> > final FileName rootName = rootFile.getName(); > >> > > >> > - if (rootFile.getType() == FileType.FILE) > >> > + if (rootFile.isFile()) > >> > { > >> > // Build the destination file name > >> > String relName = null; > >> > @@ -382,7 +382,7 @@ public abstract class AbstractSyncTask > >> > } > >> > final SourceInfo src = srcFiles.get(0); > >> > final FileObject srcFile = resolveFile(src.file); > >> > - if (srcFile.getType() != FileType.FILE) > >> > + if (!srcFile.isFile()) > >> > { > >> > final String message = > >> > > >> Messages.getString("vfs.tasks/sync.source-not-file.error", srcFile); > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -52,6 +52,7 @@ public class WebdavVersioningTests exten > >> > file.createFile(); > >> > assertTrue(file.exists()); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > assertEquals(0, file.getContent().getSize()); > >> > assertFalse(file.isHidden()); > >> > assertTrue(file.isReadable()); > >> > @@ -106,6 +107,7 @@ public class WebdavVersioningTests exten > >> > file.createFile(); > >> > assertTrue(file.exists()); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > assertEquals(0, file.getContent().getSize()); > >> > assertFalse(file.isHidden()); > >> > assertTrue(file.isReadable()); > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -288,6 +288,7 @@ public abstract class AbstractProviderTe > >> > // Check the file exists, and is a file > >> > assertTrue(file.exists()); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > > >> > // Get file content as a binary stream > >> > final byte[] expectedBin = expected.getBytes("utf-8"); > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -158,6 +158,7 @@ public class ContentTests > >> > // Check for file > >> > FileObject file = getReadFolder().resolveFile("file1.txt"); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > try > >> > { > >> > file.getChildren(); > >> > @@ -285,6 +286,7 @@ public class ContentTests > >> > // Get the test file > >> > FileObject file = getReadFolder().resolveFile("file1.txt"); > >> > assertEquals(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > > >> > // Get the file content > >> > assertSameContent(FILE1_CONTENT, file); > >> > @@ -308,6 +310,7 @@ public class ContentTests > >> > // Get the test file > >> > FileObject file = getReadFolder().resolveFile("file1.txt"); > >> > assertEquals(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > > >> > // Open some input streams > >> > final InputStream instr1 = file.getContent().getInputStream(); > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/FileSystemManagerFactoryTestCase.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/FileSystemManagerFactoryTestCase.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/FileSystemManagerFactoryTestCase.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/FileSystemManagerFactoryTestCase.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -46,6 +46,7 @@ public class FileSystemManagerFactoryTes > >> > assertNotNull(file); > >> > assertTrue(file.exists()); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > > >> > // Expand it > >> > file = manager.createFileSystem(file); > >> > > >> > Modified: > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java > >> > URL: > >> > http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java?rev=1182026&r1=1182025&r2=1182026&view=diff > >> > > >> > ============================================================================== > >> > --- > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java > >> (original) > >> > +++ > >> > commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java > >> Tue Oct 11 19:07:08 2011 > >> > @@ -114,6 +114,7 @@ public class ProviderWriteTests > >> > file.createFile(); > >> > assertTrue(file.exists()); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > assertEquals(0, file.getContent().getSize()); > >> > assertFalse(file.isHidden()); > >> > assertTrue(file.isReadable()); > >> > @@ -125,6 +126,7 @@ public class ProviderWriteTests > >> > file.createFile(); > >> > assertTrue(file.exists()); > >> > assertSame(FileType.FILE, file.getType()); > >> > + assertTrue(file.isFile()); > >> > assertEquals(0, file.getContent().getSize()); > >> > assertFalse(file.isHidden()); > >> > assertTrue(file.isReadable()); > >> > > >> > > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > >> For additional commands, e-mail: dev-h...@commons.apache.org > >> > >> > > > > > > -- > > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > > JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0 > > Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK > > Blog: http://garygregory.wordpress.com > > Home: http://garygregory.com/ > > Tweet! http://twitter.com/GaryGregory > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0 Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory