-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
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
- Specify the API: google-cloud-nio
- OS type and version: Debian 9
- Java version: 10
- google-cloud-nio version(s): 0.83-alpha
Steps to reproduce
- 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
- Stackoverflow question - https://stackoverflow.com/questions/55246844/unsupportedoperationexception-with-multipart-file-upload-using-webflux-and-sprin/55248459#55248459
- Java documentation for FileServiceProvider - https://docs.oracle.com/javase/7/docs/api/java/nio/file/spi/FileSystemProvider.html#newFileChannel(java.nio.file.Path,%20java.util.Set,%20java.nio.file.attribute.FileAttribute...)
- FilePart javadoc - https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/codec/multipart/FilePart.html#transferTo-java.nio.file.Path-
Any additional information below
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.