On Sunday 19 March 2006 09:24, Lixin Chu wrote:
> How to test is a folder exists ?
>
> I try to use webdavResource.setPath (path) and then webdavResource.exists()
>
> but setPath throws HttpException with reason code 404. is this the
> only way to  know if a folder does not exit:
>
>   try {
>          webdavResource.setPath (path);
>   } catch (HttpException he) {
>          if (he.getReasonCode() == 404) {
>             // create the folde here ...
>          }
>   }
>
> thanks !
> lx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

you forgot to query the exists() method of WebdavResource ;  

so your code shall look like :


          webdavResource.setPath (path);
          if (webdavResource.exists()){
                // do something
          } else {
                // do something else
          }


cheers

Marco
-- 
A Tale of Two Cities LITE(tm)
        -- by Charles Dickens

        A man in love with a girl who loves another man who looks just
        like him has his head chopped off in France because of a mean
        lady who knits.

Crime and Punishment LITE(tm)
        -- by Fyodor Dostoevski

        A man sends a nasty letter to a pawnbroker, but later
        feels guilty and apologizes.

The Odyssey LITE(tm)
        -- by Homer

        After working late, a valiant warrior gets lost on his way home.

Attachment: pgpFfYF8MPRdf.pgp
Description: PGP signature

Reply via email to