From fcd155b4cfbf386c3ea43a780d0640c8f77ab16b Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Tue, 21 Jan 2014 13:49:39 +0100 Subject: [PATCH] inflate zipped contents out of the lock --- .../util/io/storage/RefCountingStorage.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/platform/util/src/com/intellij/util/io/storage/RefCountingStorage.java b/platform/util/src/com/intellij/util/io/storage/RefCountingStorage.java index f2d3566dd69d..7227a3456b38 100644 --- a/platform/util/src/com/intellij/util/io/storage/RefCountingStorage.java +++ b/platform/util/src/com/intellij/util/io/storage/RefCountingStorage.java @@ -69,19 +69,20 @@ public class RefCountingStorage extends AbstractStorage { private BufferExposingByteArrayOutputStream internalReadStream(int record) throws IOException { waitForPendingWriteForRecord(record); + byte[] result; synchronized (myLock) { + result = super.readBytes(record); + } - byte[] result = super.readBytes(record); - InflaterInputStream in = new CustomInflaterInputStream(result); - try { - final BufferExposingByteArrayOutputStream outputStream = new BufferExposingByteArrayOutputStream(); - StreamUtil.copyStreamContent(in, outputStream); - return outputStream; - } - finally { - in.close(); - } + InflaterInputStream in = new CustomInflaterInputStream(result); + try { + final BufferExposingByteArrayOutputStream outputStream = new BufferExposingByteArrayOutputStream(); + StreamUtil.copyStreamContent(in, outputStream); + return outputStream; + } + finally { + in.close(); } }