This PR is similar to https://github.com/spring-projects/spring-framework/pull/24785
Also there's one more place about which I'm not sure: This code
return DataBufferUtils.join(flux)
.map(buffer -> {
byte[] result = new byte[buffer.readableByteCount()];
buffer.read(result);
DataBufferUtils.release(buffer);
return DigestUtils.md5DigestAsHex(result);
});
could be rewritten as
return DataBufferUtils.join(flux)
.map(buffer -> {
try (InputStream inputStream = buffer.asInputStream(true)) {
return DigestUtils.md5DigestAsHex(inputStream);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
But I'm not sure whether it is worth the effort.
Comment From: rstoyanchev
Thanks for the pull request. I did some further refactoring along the same lines.