Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google-cloud-nio: CloudStorageFileSystemProvider throws UnsupportedException when used with Webflux + MultipartFile upload #4702

Closed
mcgin opened this issue Mar 19, 2019 · 2 comments · Fixed by #4718
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@mcgin
Copy link

mcgin commented Mar 19, 2019

Because CloudStorageFileSystemProvider does not override the newFileChannel method it throws an UnsupportedOperationException when used for Multipart file uploads with FilePart.transferto(Path path) in a reactive Spring boot application.

Environment details

  1. Specify the API: google-cloud-nio
  2. OS type and version: Debian 9
  3. Java version: 10
  4. google-cloud-nio version(s): 0.83-alpha

Steps to reproduce

  1. See code sample

Code example

    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public Mono<Void> multipartUpload( final @RequestPart("file") FilePart filePart
    ) {

        FileSystem fileSystem = CloudStorageFileSystem.forBucket("my-bucket");
        return filePart.transferTo(fileSystem.getPath("failed-file"));
    }

Stack trace

java.lang.UnsupportedOperationException: null
    at java.base/java.nio.file.spi.FileSystemProvider.newFileChannel(FileSystemProvider.java:524)
    at java.base/java.nio.channels.FileChannel.open(FileChannel.java:292)
    at java.base/java.nio.channels.FileChannel.open(FileChannel.java:345)
    at org.springframework.http.codec.multipart.SynchronossPartHttpMessageReader$SynchronossFilePart.transferTo(SynchronossPartHttpMessageReader.java:334)

External references such as API reference guides used

Any additional information below

@ajaaym ajaaym added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: storage Issues related to the Cloud Storage API. labels Mar 20, 2019
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 20, 2019
@olavloite olavloite self-assigned this Mar 20, 2019
@sduskis
Copy link
Contributor

sduskis commented Mar 20, 2019

@meltsufin, do you have any advice for this Spring question?

@sduskis sduskis added type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 20, 2019
@meltsufin
Copy link
Member

It looks like CloudStorageFileSystemProvider needs to override newFileChannel.

@sduskis sduskis added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. Not an issue. labels Mar 20, 2019
olavloite added a commit to olavloite/google-cloud-java that referenced this issue Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants