diff options
author | 2017-08-29 15:59:53 +0200 | |
---|---|---|
committer | 2017-08-29 18:52:38 +0200 | |
commit | 763c832eaefacf19652339107c0fda37b007ab2a (patch) | |
tree | eb5fdbb17f35683cd354076d5b34191c23fb9bfa /src/main | |
parent | c291726428a7caaa6024fdb06af285fbc68f63cb (diff) |
remote: close file when uploading
RELNOTES: None
PiperOrigin-RevId: 166841380
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java b/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java index 645a693401..641cf64f11 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java +++ b/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java @@ -92,8 +92,10 @@ public final class SimpleBlobStoreActionCache implements RemoteActionCache { } private Digest uploadFileContents(Path file) throws IOException, InterruptedException { - // This unconditionally reads the whole file into memory first! - return uploadBlob(ByteString.readFrom(file.getInputStream()).toByteArray()); + try (InputStream in = file.getInputStream()) { + // This unconditionally reads the whole file into memory first! + return uploadBlob(ByteString.readFrom(in).toByteArray()); + } } private Digest uploadFileContents( |