You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stéphane Rault <ks...@yahoo.fr> on 2005/02/08 14:04:15 UTC

RE : [VFS] Problem with Zip files

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

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



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


RE : RE : [VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
Here is the result of a dir command

ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for file list
drwxr-xr-x   5 web site      152 Feb 17 10:01 .
drwxr-xr-x   5 web site      152 Feb 17 10:01 ..
drwx------   2 web site       80 Feb 17 10:01 StefTest
drwx------   3 web site       72 Jan 19 13:32 drivers
-rw-r--r--   1 web site      457 Jan 19 13:35 index.html
drwxr-xr-x   2 web site      272 Jun 16  2004 photos
226-Transfer complete.
226 Quotas: utilisation de 41 Mo sur les 1024 Mo
ftp : 322 octets reçus en 0,27 secondes à 1,19 Ko/sec.


If you need more info for testting, mail me directly and i will give you my
username and password in private.


-----Message d'origine-----
De : Mario Ivankovits [mailto:mario@ops.co.at] 
Envoyé : vendredi 25 février 2005 12:55
À : Jakarta Commons Developers List
Objet : Re: RE : [VFS] Asking for a solution with Zip files


>
>
>Caused by: org.apache.commons.vfs.FileSystemException: Could not create 
>folder "ftp://myAccount:myPassword@myFtpServer.fr/" because it already 
>exists and is a file.
>  
>

I wonder why VFS tries to create the *root* folder.
Maybe the underlaying ftp-client do have some problems in parsing the 
directory-listing ... maybe something with language settings.

Could you please provide a listing using a commandline ftp client - I 
would like to see how the directory listoutput is formatted.

---
Mario


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



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


RE : RE : [VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
By the way, i've the same behaviour with an url like
ftp://myAccount:myPassword@myFtpServer.fr/aFolderThatExist/aFileToCreate


-----Message d'origine-----
De : Mario Ivankovits [mailto:mario@ops.co.at] 
Envoyé : vendredi 25 février 2005 12:55
À : Jakarta Commons Developers List
Objet : Re: RE : [VFS] Asking for a solution with Zip files


>
>
>Caused by: org.apache.commons.vfs.FileSystemException: Could not create 
>folder "ftp://myAccount:myPassword@myFtpServer.fr/" because it already 
>exists and is a file.
>  
>

I wonder why VFS tries to create the *root* folder.
Maybe the underlaying ftp-client do have some problems in parsing the 
directory-listing ... maybe something with language settings.

Could you please provide a listing using a commandline ftp client - I 
would like to see how the directory listoutput is formatted.

---
Mario


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



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


Re: RE : [VFS] Asking for a solution with Zip files

Posted by Mario Ivankovits <ma...@ops.co.at>.
>
>
>Caused by: org.apache.commons.vfs.FileSystemException: Could not create
>folder "ftp://myAccount:myPassword@myFtpServer.fr/" because it already
>exists and is a file.
>  
>

I wonder why VFS tries to create the *root* folder.
Maybe the underlaying ftp-client do have some problems in parsing the 
directory-listing ... maybe something with language settings.

Could you please provide a listing using a commandline ftp client - I 
would like to see how the directory listoutput is formatted.

---
Mario


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


RE : [VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
Try this

    private static void main(String[] args) {

        try {

            StandardFileSystemManager manager = new
StandardFileSystemManager();
            manager.setFilesCache(new SoftRefFilesCache());
            manager.init();

            FileObject fileFtp = manager
 
.resolveFile("ftp://myAccount:myPassword@myFtpServer.fr/test.html");
            fileFtp.createFile();

        } catch (Throwable t) {

            System.out.println("It doesn't work !! : " + t);
            t.printStackTrace();
        }

I catch this stack trace : 
org.apache.commons.vfs.FileSystemException: Unknown message with code
"vfs.provider/create-file.error".
	at
org.apache.commons.vfs.provider.AbstractFileObject.createFile(AbstractFileOb
ject.java:773)
	at test.FileTest.test7(FileTest.java:181)
	at test.FileTest.main(FileTest.java:38)
Caused by: org.apache.commons.vfs.FileSystemException: Could not create
folder "ftp://myAccount:myPassword@myFtpServer.fr/" because it already
exists and is a file.
	at
org.apache.commons.vfs.provider.AbstractFileObject.createFolder(AbstractFile
Object.java:793)
	at
org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(AbstractF
ileObject.java:1120)
	at
org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(AbstractF
ileObject.java:1088)
	at
org.apache.commons.vfs.provider.AbstractFileObject.createFile(AbstractFileOb
ject.java:764)
	... 2 more

-----Message d'origine-----
De : Mario Ivankovits [mailto:mario@ops.co.at] 
Envoyé : vendredi 25 février 2005 10:45
À : Jakarta Commons Developers List
Objet : Re: [VFS] Asking for a solution with Zip files


Stéphane Rault wrote:

>Maybe one of your previous tests already created that folder??
>
>--> I want to create a new file at the root of my ftpserver. Surely the
>folder exist ! But the ftp provider seems to try to create it again. I 
>don't understadn why.
>  
>
Do you have some code-sniplet you could provide to see what you do.

Maybe a conditional createFolder like:

if (!fo.exists())
{
    fo.createFolder();
}

solve your problem !?

---
Mario


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



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


Re: [VFS] Asking for a solution with Zip files

Posted by Mario Ivankovits <ma...@ops.co.at>.
Stéphane Rault wrote:

>Maybe one of your previous tests already created that folder??
>
>--> I want to create a new file at the root of my ftpserver. Surely the
>folder exist ! But the ftp provider seems to try to create it again. I don't
>understadn why.
>  
>
Do you have some code-sniplet you could provide to see what you do.

Maybe a conditional createFolder like:

if (!fo.exists())
{
    fo.createFolder();
}

solve your problem !?

---
Mario


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


RE : RE : [VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
>Caused by : org.apache.commons.vfs.FileSystemException: Could not 
>create folder "ftp://name:password@myftpserver/aNewFile" because it 
>already exists and is a file.
>  
>
Maybe one of your previous tests already created that folder??

--> I want to create a new file at the root of my ftpserver. Surely the
folder exist ! But the ftp provider seems to try to create it again. I don't
understadn why.

And for sure, the ftp provider supports writing :-)

--> that's a good news :-)

--

Stéphane



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


RE : [VFS] Asking for a solution with Zip files

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hello!

>Caused by : org.apache.commons.vfs.FileSystemException: Could not create
>folder "ftp://name:password@myftpserver/aNewFile" because it already exists
>and is a file.
>  
>
Maybe one of your previous tests already created that folder??

And for sure, the ftp provider supports writing :-)

---
Mario


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


RE : [VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
-----Message d'origine-----
De : Mario Ivankovits [mailto:mario@ops.co.at] 
Envoyé : lundi 14 février 2005 22:22
À : Jakarta Commons Developers List
Objet : Re: [VFS] Asking for a solution with Zip files


Stéphane Rault wrote:
>I've understood that i can't resolveFile like 
>zip:file://c:/temp/toto.zip!/myFile.txt if toto.zip doesn't exist.
>  
Bad news: The ZipFileProvider does not support creating/updating 
zip-files. :-(

--> Really a bad news ! But I'm not able to develop it on my own so, I will
manage to do without

>The same question is available if the URL is 
>ftp://myserver.fr/myNotCreatedDirectory/theFileIWantToPut.ext.
>  
FileObject fo = 
VFS.getManager().resolveFile("ftp://myserver.fr/myNotCreatedDirectory/theFil
eIWantToPut.ext");
fo.getParent().createFolder();
fo.createFile();

--> I leave this problem because I've another one to deal with : 
When I try to create a file like this
ftp://name:password@myftpserver/aNewFile I catch an Exception like this one
org.apache.commons.vfs.FileSystemException: Unknown message with code
"vfs.provider/create-file.error".
	at
org.apache.commons.vfs.provider.AbstractFileObject.createFile(AbstractFileOb
ject.java:773)
Caused by : org.apache.commons.vfs.FileSystemException: Could not create
folder "ftp://name:password@myftpserver/aNewFile" because it already exists
and is a file.
	at
org.apache.commons.vfs.provider.AbstractFileObject.createFolder(AbstractFile
Object.java:793)
	at
org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(AbstractF
ileObject.java:1120)
	at
org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(AbstractF
ileObject.java:1088)
	at
org.apache.commons.vfs.provider.AbstractFileObject.createFile(AbstractFileOb
ject.java:764)
	... 3 more


Following the code, I see that i decide to create the folder even if it
exist..

Is it a bug ? FTP Provider is writable ?

Thanks 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


Re: [VFS] Asking for a solution with Zip files

Posted by Mario Ivankovits <ma...@ops.co.at>.
Stéphane Rault wrote:
>I've understood that i can't resolveFile like
>zip:file://c:/temp/toto.zip!/myFile.txt if toto.zip doesn't exist.
>  
Bad news: The ZipFileProvider does not support creating/updating 
zip-files. :-(
>The same question is available if the URL is
>ftp://myserver.fr/myNotCreatedDirectory/theFileIWantToPut.ext.
>  
FileObject fo = 
VFS.getManager().resolveFile("ftp://myserver.fr/myNotCreatedDirectory/theFileIWantToPut.ext");
fo.getParent().createFolder();
fo.createFile();


Hope this helps, though I didnt think so.

---
Mario


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


RE : [VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
If no one else solved your problem in the meantime I will have a look at 
it start next week.

--> Thanks a lot. I admit that I'm a bit lost in the code... (but I'm a
beginner with VFS). For what I've seen, It's a hard coded test which throw
an exception when the file doesn't exist. I think it's necessary for the
following code but I can't manage to see where and how...

(And all the other stuff collected this week in the mailinglist. Its 
odd, all the time this list is so silent and if I am on vacation there 
starts a mailstorm)


--> Oh I see...You've been introduced to Mr. Murphy too :-)



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


Re: [VFS] Asking for a solution with Zip files

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hello!

I am on vacation this week, and only a very poor internet connection.

If no one else solved your problem in the meantime I will have a look at 
it start next week.

(And all the other stuff collected this week in the mailinglist. Its 
odd, all the time this list is so silent and if I am on vacation there 
starts a mailstorm)

---
Mario


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


[VFS] Asking for a solution with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
OK, my problem is that I want to create some files in an inexisting
location.

I've understood that i can't resolveFile like
zip:file://c:/temp/toto.zip!/myFile.txt if toto.zip doesn't exist.

But How can I manipulate the URL to create first the file and then create
its son. (The same question is available if the URL is
ftp://myserver.fr/myNotCreatedDirectory/theFileIWantToPut.ext).

Did someone have a tip for me or do I have to parse theURL on my own to do
the trick ?

Thanks in advance...

Stéphane.



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


RE : RE : [VFS] Problem with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
>From what I gather, you're trying to do this on a zip file
that doesn't exist - afaik, the root of a file system has
to exist, it's not possible to create a file system from
a non existing root.

Not 100% certain about this, but try it with a zip
that exists first and see if that works..


--> Yes it works with an existing zip (and I had no doubt an it). But I
wonder I have to create the zip before I can put something in it. I will try
this way...

Thanks for your help...



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


Re: RE : [VFS] Problem with Zip files

Posted by fi...@cirquedigital.com.
....
> But with the same exception :
> org.apache.commons.vfs.FileSystemException: Could not replicate
> "file://c:/temp/toto.zip" as it does not exist.
...
> 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 :-) ?
>
...

>From what I gather, you're trying to do this on a zip file
that doesn't exist - afaik, the root of a file system has
to exist, it's not possible to create a file system from
a non existing root.

Not 100% certain about this, but try it with a zip
that exists first and see if that works..

- Filip



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


RE : [VFS] Problem with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
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


Re: [VFS] Problem with Zip files

Posted by Rob Oxspring <ro...@imapmail.org>.
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.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)
>>
>>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
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 

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


RE : RE : [VFS] Problem with Zip files

Posted by Stéphane Rault <ks...@yahoo.fr>.
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.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)
> 
> 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
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 

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



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


Re: RE : [VFS] Problem with Zip files

Posted by Rob Oxspring <ro...@imapmail.org>.
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(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)
> 
> 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
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 

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