Hi,

maybe I don't get your point. You state that
- webdavResource.getChildResources().getResources() contains null elements
- webdavResource.getChildResources().listResources() is correct.

I would say that's not possible, because listResources() uses
getResources() internally and it does not check for null elements.
Also, if there really were null elements you surely would have gotten
a NullPointerException before.

Ingo

> Hi !
> 
> Could someone explain me why the short piece of commented code here after
> doesn't work ?
> 
> It seems that the Enumeration returned by getResources() contains null
> elements within it as I could see in debug mode. Then I coded the good old
> "for" loop trying to "jump" over the null elements. I could get the list of
> elements (files and subdirectories). In fact the returned list by
> listResources() is correct, there is in fact no need to check each element.
> I wonder why the Enumeration contains nulls (getResourceNames() has the same
> behaviour...).
> 
> Thanks for any hints !
> Olivier
> 
> P.S. The webdav server is Slide2.0+Tomcat4.1.30
> 
> -------------------------
>               if (webdavResource.isCollection()) {
> //                    Enumeration wdrs =
> webdavResource.getChildResources().getResources();
> //                    while (wdrs.hasMoreElements()) {
> //                            WebdavResource resource = (WebdavResource)
> wdrs.nextElement();
> //                            recursivelist(resource.getPath());
> //                    }
>                       WebdavResource[] listOfResources =
> webdavResource.getChildResources().listResources();
>                       for(int i=0; i< listOfResources.length; i++) {
>                               WebdavResource wdr = listOfResources[i];
>                               if (wdr != null) {
>                                       recursivelist(wdr.getPath());
>                               } 
>                       }
>               }
> --------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to