public List<B2FileInfoResponse> find(final Path file) throws BackgroundException {
        if(log.isDebugEnabled()) {
            log.debug(String.format("Finding multipart uploads for %s", file));
        }
        try {
            final List<B2FileInfoResponse> uploads = new ArrayList<B2FileInfoResponse>();
            // This operation lists in-progress multipart uploads. An in-progress multipart upload is a
            // multipart upload that has been initiated, using the Initiate Multipart Upload request, but has
            // not yet been completed or aborted.
            String startFileId = null;
            do {
                final B2ListFilesResponse chunk;
                chunk = session.getClient().listUnfinishedLargeFiles(
                    fileid.getVersionId(containerService.getContainer(file)), startFileId, null);
                for(B2FileInfoResponse upload : chunk.getFiles()) {
                    if(file.isDirectory()) {
                        final Path parent = new Path(containerService.getContainer(file), upload.getFileName(), EnumSet.of(Path.Type.file)).getParent();
                        if(new SimplePathPredicate(parent).test(file)) {
                            uploads.add(upload);
                        }
                    }
                    else {
                        if(StringUtils.equals(upload.getFileName(), containerService.getKey(file))) {
                            uploads.add(upload);
                        }
                    }
                }
                if(log.isInfoEnabled()) {
                    log.info(String.format("Found %d previous multipart uploads for %s", uploads.size(), file));
                }
                startFileId = chunk.getNextFileId();
            }
            while(startFileId != null);
            if(log.isInfoEnabled()) {
                for(B2FileInfoResponse upload : uploads) {
                    log.info(String.format("Found multipart upload %s for %s", upload, file));
                }
            }
            // Uploads are listed in the order they were started, with the oldest one first
            uploads.sort(new Comparator<B2FileInfoResponse>() {
                @Override
                public int compare(final B2FileInfoResponse o1, final B2FileInfoResponse o2) {
                    return o1.getUploadTimestamp().compareTo(o2.getUploadTimestamp());
                }
            });
            Collections.reverse(uploads);
            return uploads;
        }
        catch(B2ApiException e) {
            throw new B2ExceptionMappingService(fileid).map("Upload {0} failed", e, file);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map("Upload {0} failed", e, file);
        }
    }
@Test
    public void testFindAllPendingInBucket() throws Exception {
        final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
        final Path file = new Path(bucket, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        final B2VersionIdProvider fileid = new B2VersionIdProvider(session);
        final B2StartLargeFileResponse start1Response = session.getClient().startLargeFileUpload(
            fileid.getVersionId(bucket),
            file.getName(), null, Collections.emptyMap());
        final B2StartLargeFileResponse start2Response = session.getClient().startLargeFileUpload(
            fileid.getVersionId(bucket),
                file.getName(), null, Collections.emptyMap());
        final List<B2FileInfoResponse> list = new B2LargeUploadPartService(session, fileid).find(file);
        assertFalse(list.isEmpty());
        assertEquals(start2Response.getFileId(), list.get(0).getFileId());
        assertEquals(start1Response.getFileId(), list.get(1).getFileId());
        session.getClient().cancelLargeFileUpload(start1Response.getFileId());
        session.getClient().cancelLargeFileUpload(start2Response.getFileId());
    }