diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileSystemEntry.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileSystemEntry.java index 22cf94d60106..62b1b913eb94 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileSystemEntry.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileSystemEntry.java @@ -29,6 +29,7 @@ import com.intellij.openapi.vfs.encoding.EncodingManager; import com.intellij.openapi.vfs.encoding.EncodingRegistry; import com.intellij.openapi.vfs.newvfs.NewVirtualFile; import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; +import com.intellij.psi.SingleRootFileViewProvider; import com.intellij.util.io.IOUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -440,6 +441,9 @@ public abstract class VirtualFileSystemEntry extends NewVirtualFile { charset = configured == null ? Charset.defaultCharset() : configured; setCharset(charset); } + else if (SingleRootFileViewProvider.isTooLargeForContentLoading(this)) { + charset = super.getCharset(); + } else { try { final byte[] content; diff --git a/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java b/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java index c4970f1fe8b8..3b8b2bd9ab3f 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java +++ b/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java @@ -367,10 +367,6 @@ public class FileUtilRt { @NotNull public static byte[] loadBytes(@NotNull InputStream stream, int length) throws IOException { - if (isTooLarge(length)) { - throw new FileTooBigException("Too large file, size is " + length + " bytes."); - } - byte[] bytes = new byte[length]; int count = 0; while (count < length) {