@Override
    public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
        if(file.isRoot()) {
            return PathAttributes.EMPTY;
        }
        try {
            try {
                for(final DavResource resource : this.list(file)) {
                    if(resource.isDirectory()) {
                        if(!file.getType().contains(Path.Type.directory)) {
                            throw new NotfoundException(String.format("File %s has set MIME type %s",
                                    file.getAbsolute(), DavResource.HTTPD_UNIX_DIRECTORY_CONTENT_TYPE));
                        }
                    }
                    else {
                        if(!file.getType().contains(Path.Type.file)) {
                            throw new NotfoundException(String.format("File %s has set MIME type %s",
                                    file.getAbsolute(), resource.getContentType()));
                        }
                    }
                    return this.toAttributes(resource);
                }
                throw new NotfoundException(file.getAbsolute());
            }
            catch(SardineException e) {
                try {
                    throw new DAVExceptionMappingService().map("Failure to read attributes of {0}", e, file);
                }
                catch(InteroperabilityException | ConflictException i) {
                    // PROPFIND Method not allowed
                    if(log.isWarnEnabled()) {
                        log.warn(String.format("Failure with PROPFIND request for %s. %s", file, i.getMessage()));
                    }
                    final PathAttributes attr = this.head(file);
                    if(PathAttributes.EMPTY == attr) {
                        throw i;
                    }
                    return attr;
                }
            }
        }
        catch(SardineException e) {
            throw new DAVExceptionMappingService().map("Failure to read attributes of {0}", e, file);
        }
        catch(IOException e) {
            throw new HttpExceptionMappingService().map(e, file);
        }
    }
@Test
    public void testFindLock() throws Exception {
        final Path test = new DAVTouchFeature(session).touch(new Path(new DefaultHomeFinderService(session).find(),
                new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final DAVAttributesFinderFeature f = new DAVAttributesFinderFeature(session);
        assertNull(f.find(test).getLockId());
        try {
            final String lockId = new DAVLockFeature(session).lock(test);
            assertNotNull(f.find(test).getLockId());
            new DAVLockFeature(session).unlock(test, lockId);
        }
        catch(InteroperabilityException e) {
            // No lock support
        }
        new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledPasswordCallback(), new Delete.DisabledCallback());
    }