From d210344be29f8b855270e338fd08f64a60ce102f Mon Sep 17 00:00:00 2001 From: Julian Reschke Date: Fri, 10 Jan 2025 10:22:08 +0100 Subject: [PATCH] OAK-11377: Remove usage of Guava ByteStreams.toByteArray() - avoid deprecated method --- .../oak/plugins/blob/cloud/CloudBlobStore.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/cloud/CloudBlobStore.java b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/cloud/CloudBlobStore.java index cd56cb92264..a2bd25e4930 100644 --- a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/cloud/CloudBlobStore.java +++ b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/cloud/CloudBlobStore.java @@ -156,13 +156,10 @@ protected byte[] readBlockFromBackend(BlockId blockId) throws Exception { LOG.error(message); throw new IOException(message); } - - Payload payload = cloudBlob.getPayload(); - try { - data = payload.getInput().readAllBytes(); - cache.put(id, data); - } finally { - payload.close(); + + try (Payload payload = cloudBlob.getPayload()) { + data = payload.openStream().readAllBytes(); + cache.put(id, data); } } if (blockId.getPos() == 0) {