Description
Nick Stolwijk opened DATAMONGO-2392 and commented
I have a problem with the ReactiveGridFsTemplate. I am trying to read a GridFS file written with the old GridFS (com.mongodb.gridfs) instead of the new GridFS (com.mongodb.client.gridfs.model.GridFS) with an UUID as an ID instead of the ObjectId. Reading the GridFS file metainfo goes fine, but as soon as I want to get the ReactiveGridFsResource it blows with a nice new MongoGridFSException("Custom id type used for this GridFS file").
The culprit is the code below from ReactiveGridFsTemplate which calls the getObjectId() instead of the getId().
// Some comments here
public Mono<ReactiveGridFsResource> getResource(GridFSFile file) \{
Assert.notNull(file, "GridFSFile must not be null!");
return Mono.fromSupplier(() -> {
GridFSDownloadStream stream = this.getGridFs().openDownloadStream(file.getObjectId());
return new ReactiveGridFsResource(file, BinaryStreamAdapters.toPublisher(stream, this.dataBufferFactory));
});
Affects: 2.2 GA (Moore)
Reference URL: https://stackoverflow.com/questions/58335826/stackoverflowerror-while-reading-file-from-reactive-gridfs
Referenced from: pull request #796
Backported to: 2.2.1 (Moore SR1)