@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        try {
            final AttributedList<Path> children = new AttributedList<>();
            for(List<DavResource> list : ListUtils.partition(this.list(directory),
                    new HostPreferences(session.getHost()).getInteger("webdav.listing.chunksize"))) {
                for(final DavResource resource : list) {
                    if(new SimplePathPredicate(new Path(resource.getHref().getPath(), EnumSet.of(Path.Type.directory))).test(directory)) {
                        log.warn(String.format("Ignore resource %s", resource));
                        // Do not include self
                        if(resource.isDirectory()) {
                            continue;
                        }
                        throw new NotfoundException(directory.getAbsolute());
                    }
                    final PathAttributes attr = attributes.toAttributes(resource);
                    final Path file = new Path(directory, PathNormalizer.name(resource.getHref().getPath()),
                            resource.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file), attr);
                    children.add(file);
                    listener.chunk(directory, children);
                }
            }
            return children;
        }
        catch(SardineException e) {
            throw new DAVExceptionMappingService().map("Listing directory {0} failed", e, directory);
        }
        catch(IOException e) {
            throw new HttpExceptionMappingService().map(e, directory);
        }
    }
@Test(expected = NotfoundException.class)
    public void testListNotfound() throws Exception {
        new DAVListService(session).list(new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)),
                new DisabledListProgressListener());
    }