Menu

#1 possible OutOfMemoryError

open
nobody
None
5
2010-01-19
2010-01-19
Anonymous
No

Hi,

there seems to be a bug in org.apache.commons.vfs.provider.webdav.WebdavFileObject.existsTest. If you do something like this:

FileObject file = VFS.getManager().resolveFile(url);
if (file.exists() && file.getType() == FileType.FOLDER) {
...
}

you may get an OutOfMemoryError because the code leeds to an PROPFIND call with depth invinity. If you got a lot of content behind the url/folder an OutOfMemoryError will occur.

I think you just need to change the first line in the existsTest method from

-> final PropFindMethod propFindMethod = new PropFindMethod(pathEncoded);

to

-> final PropFindMethod propFindMethod = new PropFindMethod(pathEncoded, DepthSupport.DEPTH_0);

best regards
Achim Heiland

Discussion


Log in to post a comment.