@Override
    public boolean find(final Path file, final ListProgressListener listener) throws BackgroundException {
        try {
            if(containerService.isContainer(file)) {
                final List<B2BucketResponse> buckets = session.getClient().listBuckets();
                for(B2BucketResponse bucket : buckets) {
                    if(StringUtils.equals(containerService.getContainer(file).getName(), bucket.getBucketName())) {
                        return true;
                    }
                }
            }
            else {
                try {
                    attributes.find(file, listener);
                    return true;
                }
                catch(NotfoundException e) {
                    return false;
                }
            }
            return false;
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService(fileid).map("Failure to read attributes of {0}", e, file);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file);
        }
    }
@Test
    public void testFindCommonPrefix() throws Exception {
        final B2VersionIdProvider fileid = new B2VersionIdProvider(session);
        final Path container = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
        assertTrue(new B2FindFeature(session, fileid).find(container));
        final String prefix = new AlphanumericRandomStringService().random();
        final Path intermediate = new Path(container, prefix, EnumSet.of(Path.Type.directory));
        final Path test = new B2TouchFeature(session, fileid).touch(new Path(intermediate, new AsciiRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        assertTrue(new B2FindFeature(session, fileid).find(test));
        assertFalse(new B2FindFeature(session, fileid).find(new Path(test.getAbsolute(), EnumSet.of(Path.Type.directory))));
        assertTrue(new B2FindFeature(session, fileid).find(intermediate));
        // Ignore 404 for placeholder and search for common prefix
        assertTrue(new B2FindFeature(session, fileid).find(new Path(container, prefix, EnumSet.of(Path.Type.directory, Path.Type.placeholder))));
        assertTrue(new B2ObjectListService(session, fileid).list(intermediate,
                new DisabledListProgressListener()).contains(test));
        new B2DeleteFeature(session, fileid).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new B2FindFeature(session, fileid).find(test));
        assertFalse(new B2FindFeature(session, fileid).find(intermediate));
        final PathCache cache = new PathCache(1);
        final Path directory = new Path(container, prefix, EnumSet.of(Path.Type.directory, Path.Type.placeholder));
        assertFalse(new CachingFindFeature(session, cache, new B2FindFeature(session, fileid)).find(directory));
        assertFalse(cache.isCached(directory));
        assertFalse(new B2FindFeature(session, fileid).find(new Path(container, prefix, EnumSet.of(Path.Type.directory, Path.Type.placeholder))));
    }