From e6cf8c52eba70ded106cf2f46b39db34c48eb2ab Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 7 Oct 2015 14:59:58 +0200 Subject: [PATCH] Avoid throwing arbitrary exceptions (AssertionError / AIOBE due to corrupted code), translate them to IOExceptions (EA-74073, EA-69880) --- .../src/com/intellij/util/io/CompressedAppendableFile.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java b/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java index 32e1faed15b4..052a63d2a8b6 100644 --- a/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java +++ b/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java @@ -22,7 +22,6 @@ import com.intellij.util.CompressionUtil; import com.intellij.util.SystemProperties; import com.intellij.util.containers.SLRUMap; import gnu.trove.TLongArrayList; -import org.iq80.snappy.CorruptionException; import org.jetbrains.annotations.NotNull; import java.io.*; @@ -201,11 +200,13 @@ public class CompressedAppendableFile { } catch (IOException ignore) {} } - assert false; + assert false:"data corruption detected:"+chunkNumber + "," + myChunkTableLength; return ArrayUtil.EMPTY_BYTE_ARRAY; } - catch (CorruptionException e) { + catch (RuntimeException e) { // CorruptedException, ArrayIndexOutofBounds, etc throw new IOException(e); + } catch(AssertionError ae) { + throw new IOException(ae); } }