Michal Stochmialek wrote:

On Mon, Jun 28, 2004 at 12:13:27PM +0200, Unico Hommes wrote:



Something's wrong with implementation of getParent and makeCollection methods.
(in cocoon 2.1.5)


makeCollection() - creates collection only if parent exists. Can't create
directory hierarchy. When I try, i've got this exception:

Directory einformatyka/articles exists, review - don't.

Is this correct implementation of ModifiableTraversableSource?



Nope, you found a bug :-)



It tried again makeCollection method, and i've got exception below:

Caused by: org.apache.excalibur.source.SourceException:
Unable to create collection 
webdav://localhost/svn/einformatyka/articles/review/1088515900892.  Server responded 
404 (Not Found (404))
    at 
org.apache.cocoon.components.source.impl.WebDAVSource.makeCollection(WebDAVSource.java:763)
    at 
pl.einformatyka.common.components.filesystem.FileManagerImpl.createDirectory(FileManagerImpl.java:79)




private void createDirectories(ModifiableTraversableSource source) throws SourceException
{
System.out.println("Creating dir ["+source.getURI()+"] " + " EXISTS: "+source.exists());


        if (source.exists()) return;
        if (!source.getParent().exists())
                createDirectories((ModifiableTraversableSource)source.getParent());
        
        source.makeCollection();
}






Yes, is also a bug. It seems that in some cases getParent() would return itself as its parent collection. I've just committed a fix for both problems. I think its fixed now but haven't the opportunity to test. Could you check if it works for you now?



I've run above method again, and getParent throwed this exception:

org.apache.excalibur.source.SourceNotFoundException: Not found: 
webdav://localhost/svn/einformatyka/articles/review/1088515426783
    at 
org.apache.cocoon.components.source.impl.WebDAVSource.initResource(WebDAVSource.java:225)
    at 
org.apache.cocoon.components.source.impl.WebDAVSource.getParent(WebDAVSource.java:605)
    at 
pl.einformatyka.common.components.filesystem.FileManagerImpl.createDirectories(FileManagerImpl.java:94)
    at 
pl.einformatyka.common.components.filesystem.FileManagerImpl.createDirectory(FileManagerImpl.java:80)
    ... 5 more
Caused by: org.apache.commons.httpclient.HttpException
    at org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3185)
    at org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3145)
    at org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:879)
    at org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.java:824)
    at org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1746)
    at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1156)
    at org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:242)
    at 
org.apache.cocoon.components.source.impl.WebDAVSource.initResource(WebDAVSource.java:211)

I think you need some testcase ;)



Actually I don't. It already exists. See src/blocks/webdav/test . I added your scenario and fixed the problem. Try again now.


--
Unico

Reply via email to