[ http://issues.apache.org/jira/browse/VFS-39?page=comments#action_12439595 ] Mario Ivankovits commented on VFS-39: -------------------------------------
Its a long time back, I know - so - do you have (or can you create) a patch for the current VFS svn head? And two notes: 1) it seems you used the TAR implementation as base, there are still pointers to it in your code, please remove/rename them. 2) you often catched the Exception and discarded it or printed it using e.printStackTrace(), this is not allowed. Please change it to either rethrow it as FileSystemException or log them using the logging e.g. like in FtpFileSystem (VfsLog.warn(getLogger(), log, "vfs.provider.ftp/close-connection.error", e);) Thanks! > [VFS] read/write XML support > ---------------------------- > > Key: VFS-39 > URL: http://issues.apache.org/jira/browse/VFS-39 > Project: Commons VFS > Issue Type: Improvement > Affects Versions: Nightly Builds > Environment: Operating System: other > Platform: Other > Reporter: Benoit Callebaut > Priority: Minor > Attachments: package.html, patchfile, test.xml, > VFSXmlFileObject.java, VFSXmlFileProvider.java, VFSXmlFileSystem.java > > > Here is the patch and necessary files for adding XML support for VFS. > I don't know how to include new files in a patch, so I will put them on the > mailing list. > I am not a test writer specialist, so there is no specific test case for this > provider but I tested it and it works. > Index: vfs/src/test/org/apache/commons/vfs/RunTest.java > =================================================================== > --- vfs/src/test/org/apache/commons/vfs/RunTest.java (revision 404758) > +++ vfs/src/test/org/apache/commons/vfs/RunTest.java (working copy) > @@ -26,6 +26,7 @@ > import org.apache.commons.vfs.provider.url.test.UrlProviderHttpTestCase; > import org.apache.commons.vfs.provider.test.VirtualProviderTestCase; > import org.apache.commons.vfs.provider.test.GenericFileNameTestCase; > +import org.apache.commons.vfs.provider.xml.test.XmlProviderTestCase; > import java.util.Properties; > @@ -67,6 +68,7 @@ > // WebdavProviderTestCase.suite(), > SftpProviderTestCase.suite(), > + XmlProviderTestCase.suite(), > // JarProviderTestCase.suite(), > // NestedJarTestCase.suite(), > Index: vfs/src/java/org/apache/commons/vfs/impl/providers.xml > =================================================================== > --- vfs/src/java/org/apache/commons/vfs/impl/providers.xml (revision > 404758) > +++ vfs/src/java/org/apache/commons/vfs/impl/providers.xml (working copy) > @@ -51,6 +51,9 @@ > <provider > class-name="org.apache.commons.vfs.provider.res.ResourceFileProvider"> > <scheme name="res"/> > </provider> > + <provider > class-name="org.apache.commons.vfs.provider.xml.VFSXmlFileProvider"> > + <scheme name="xml"/> > + </provider> > <!-- > <provider > class-name="org.apache.commons.vfs.provider.tar.TgzFileProvider"> > <scheme name="tgz"/> > @@ -78,8 +81,10 @@ > <scheme name="ram"/> > </provider> > + <extension-map extension="xml" scheme="xml"/> > <extension-map extension="zip" scheme="zip"/> > <extension-map extension="tar" scheme="tar"/> > + <mime-type-map mime-type="application/xml" scheme="xml"/> > <mime-type-map mime-type="application/zip" scheme="zip"/> > <mime-type-map mime-type="application/x-tar" scheme="tar"/> > <mime-type-map mime-type="application/x-gzip" scheme="gz"/> > Index: vfs/src/java/org/apache/commons/vfs/FileType.java > =================================================================== > --- vfs/src/java/org/apache/commons/vfs/FileType.java (revision 404758) > +++ vfs/src/java/org/apache/commons/vfs/FileType.java (working copy) > @@ -46,7 +46,7 @@ > private final boolean hasContent; > private final boolean hasAttrs; > - private FileType(final String name, > + public FileType(final String name, > final boolean hasChildren, > final boolean hasContent, > final boolean hasAttrs) > @@ -96,4 +96,14 @@ > { > return hasAttrs; > } > + > + public boolean equals(Object obj){ > + if (!(obj instanceof FileType)) return false; > + FileType ob = (FileType)obj; > + if (this.hasContent() && ob.hasContent()) return true; > + if (this.hasChildren() && ob.hasChildren()) return true; > + if (this.hasAttributes() && ob.hasAttributes()) return true; > + > + return false; > + } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]