commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stéphane Rault <ksbra...@yahoo.fr>
Subject RE : [VFS] Problem with Zip files
Date Wed, 09 Feb 2005 13:25:40 GMT
Hello Rob, 

I tried : 
zip://c:/temp/toto.zip
zip:file://c:/temp/toto.zip

But with the same exception :
org.apache.commons.vfs.FileSystemException: Could not replicate
"file://c:/temp/toto.zip" as it does not exist.
	at
org.apache.commons.vfs.provider.AbstractFileSystem.replicateFile(AbstractFil
eSystem.java:310)
	at
org.apache.commons.vfs.provider.zip.ZipFileSystem.<init>(ZipFileSystem.java:
59)
	at
org.apache.commons.vfs.provider.zip.ZipFileProvider.doCreateFileSystem(ZipFi
leProvider.java:83)
	at
org.apache.commons.vfs.provider.AbstractLayeredFileProvider.createFileSystem
(AbstractLayeredFileProvider.java:77)
	at
org.apache.commons.vfs.provider.AbstractLayeredFileProvider.findFile(Abstrac
tLayeredFileProvider.java:57)
	at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFile
SystemManager.java:505)
	at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFile
SystemManager.java:483)
	at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFile
SystemManager.java:453)
	at test.FileTest.test6(FileTest.java:154)
	at test.FileTest.main(FileTest.java:37)

I think this is a bug in zip protocol as it tried to wrap the file protocol
but can't manage to do it with a -non-existant file.
Am I Wrong again :-) ?


-----Message d'origine-----
De : Rob Oxspring [mailto:roxspring@imapmail.org] 
Envoyé : mercredi 9 février 2005 13:23
À : Jakarta Commons Developers List
Objet : Re: [VFS] Problem with Zip files


Hang on - you've switched protocols there - You asked about "file:" urls not

"zip:" urls!

Looking at the vfs docs 
(http://jakarta.apache.org/commons/sandbox/vfs/filesystems.html) it would
seem 
that any of the following would refer to the file that you are after:

     file://C:/temp/toto.zip
     c:\temp\toto.zip
     c:/temp/toto.zip

Note that the url version uses '/' symbols not '\' from your example.

If you want to use the zip protocol then you need to wrap a file url, and 
usually refer to an entry within the zip: (I'm not sure what you get without

referring to an entry)
     zip:file://C:/temp/toto.zip

Hope that helps,

Rob

Stéphane Rault wrote:
> Unfortunately, you're wrong :
> I've put 
> 
> FileObject fileZip = manager.resolveFile("zip:///c:\\temp\\toto.zip");
> 
> And I got :
> 
> org.apache.commons.vfs.FileSystemException: Could not find file with 
> URI "///c:\temp\toto.zip" because it is a relative path, and no base 
> URI was provided.
> 
> 
> -----Message d'origine-----
> De : Rob Oxspring [mailto:roxspring@imapmail.org]
> Envoyé : mardi 8 février 2005 17:37
> À : Jakarta Commons Developers List
> Objet : Re: RE : [VFS] Problem with Zip files
> 
> 
> I haven't used vfs (yet) but I'm pretty sure the the file url should 
> have 3
> slashes:
> 	"file:///c:/temp/toto.zip"
> because urls reserve the spot between slash 2 and 3 for a host/port.
> 
> Rob
> 
> Stéphane Rault wrote:
> 
>>XmlBeans doesn't matter in any way in my problem. Sorry for the
>>confusion !!
>>
>>But my real problem with Zip file is still alive :-(
>>
>>Here is the stack trace of the exception catched :
>>
>>org.apache.commons.vfs.FileSystemException: Could not replicate
>>"file://c:/temp/toto.zip" as it does not exist.
>>	at 
>>org.apache.commons.vfs.provider.AbstractFileSystem.replicateFile(Abstr
>>actFil
>>eSystem.java:310)
>>	at
>>
> 
> org.apache.commons.vfs.provider.zip.ZipFileSystem.<init>(ZipFileSystem
> .java:
> 
>>59)
>>	at
>>
> 
> org.apache.commons.vfs.provider.zip.ZipFileProvider.doCreateFileSystem
> (ZipFi
> 
>>leProvider.java:83)
>>	at
>>
> 
> org.apache.commons.vfs.provider.AbstractLayeredFileProvider.createFile
> System
> 
>>(AbstractLayeredFileProvider.java:77)
>>	at
>>
> 
> org.apache.commons.vfs.provider.AbstractLayeredFileProvider.findFile(A
> bstrac
> 
>>tLayeredFileProvider.java:57)
>>	at
>>
> 
> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(Defau
> ltFile
> 
>>SystemManager.java:505)
>>	at
>>
> 
> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(Defau
> ltFile
> 
>>SystemManager.java:483)
>>	at
>>
> 
> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(Defau
> ltFile
> 
>>SystemManager.java:453)
>>	at test.FileTest.test6(FileTest.java:154)
>>	at test.FileTest.main(FileTest.java:37)
>>
>>In the API, resolveFile may worked even with file which doesn't exist
>>(Am I wrong ?)
>>
>>
>>-----Message d'origine-----
>>De : Stéphane Rault [mailto:ksbrault@yahoo.fr]
>>Envoyé : mardi 8 février 2005 08:43
>>À : commons-dev@jakarta.apache.org
>>Objet : [VFS] Problem with Zip files
>>
>>
>>I've a problem accessing Zip files with VFS API. I'm using XmlBeans V2
>>(cause of a bug in V1) compiled the 10 jan 2005.
>>
>>Here is my sample code :
>>
>>        try {
>>            
>>            StandardFileSystemManager manager = new
>>StandardFileSystemManager();
>>            manager.setFilesCache(new SoftRefFilesCache());
>>            manager.init();
>>            
>>            // toto.txt doesn't exist in the folder
>>            FileObject fileTxt =
> 
> manager.resolveFile("c:\\temp\\toto.txt");
> 
>>            System.out.println("File Text works !!");
>>            
>>            // toto.zip doesn't exist in the folder
>>            FileObject fileZip =
>>manager.resolveFile("zip://c:\\temp\\toto.zip");
>>            System.out.println("File Zip works !!");
>>            
>>            // The file and the folder don't exist
>>            FileObject fileInUnknownFolder =
>>manager.resolveFile("c:\\notPresentFolder\\toto.txt");
>>            System.out.println("File in unknown Folder works !!");
>>            
>>        } catch (Throwable t) {
>>
>>            System.out.println("It doesn't work !!");
>>        }
>>
>>And here is the output :
>>
>>File Text works !!
>>It doesn't work !!
>>
>>Note that c:\\temp is an existing directory.
>>
>>Thanks in advance for your help...
>>
>>Stéphane.



---------------------------------------------------------------------
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