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] Asking for a solution with Zip files
Date Fri, 25 Feb 2005 09:53:59 GMT
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


Mime
View raw message