An implicit property find request is done without knowing whether the URL
specifies a null resource or not. I agree that the exception makes no sense for
this case and the situation should be handled smarter.
As workaround create the WebdavResource in this way:
WebdavResource webdavResourceTempFile = new WebdavResource(
httpURL, WebdavResource.NOACTION, 0
);
> -----Original Message-----
> From: Max Muller [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 10, 2004 6:49 PM
> To: [EMAIL PROTECTED]
> Subject: Constructing a WebdavResource for a resource that doesn't exist
> throws
>
> Hola,
> I hope this isn't a redundant post, I have searched through some of
> the back archives but I haven't come across an answer.
>
> Essentially this is the bit of code that I'm trying to get to run:
>
> HttpURL rootUrl = new HttpURL(uploadServerURL + "/" +
> providerFolderName);
> rootUrl.setUserinfo(userName, password);
> WebdavResource providerDirectory = new WebdavResource(rootUrl);
>
> if (!providerDirectory.exists()) {
> log.info("Provider directory: " + providerFolderName + "
> does not exist, creating.");
> providerDirectory.mkcolMethod();
> }
>
> However the constructor of the WebdavResource throws an HttpException
> with status code 404. The 404 bit makes sense because the first time
> this bit of code runs the directory hasn't been created yet. I have
> verified this with both the 2.0 and 2.1RC1 versions of the WebDAV
> client. Constructing the WebdavResource for just the rootUrl works just
> fine in the above example. Any pointers on what I must be doing wrong
> would be greatly appreciated. Thanks!
>
> Regards,
> Max
>
> Stack dump from the 2.1RC1:
>
> at
> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:
> 3467)
> at
> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:
> 3423)
> at
> org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:
> 967)
> at
> org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.j
> ava:912)
> at
> org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:
> 1894)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:
> 1301)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:
> 1320)
> at
> org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:
> 1408)
> at
> org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:290)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]