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/10 11:15:18 UTC

[VFS] Asking for a solution with Zip files

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