assert about read action on each getDocument invocation (to get more exceptions)
authorpeter <peter@jetbrains.com>
Wed, 25 Feb 2015 07:57:37 +0000 (08:57 +0100)
committerpeter <peter@jetbrains.com>
Wed, 25 Feb 2015 09:54:08 +0000 (10:54 +0100)
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java

index d402808fe4048aef775677c16109b297444f148c..8ffec9b71430c4ce3b941e8d3bae261f84868970 100644 (file)
@@ -166,6 +166,7 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt
   @Override
   @Nullable
   public Document getDocument(@NotNull final VirtualFile file) {
+    ApplicationManager.getApplication().assertReadAccessAllowed();
     DocumentEx document = (DocumentEx)getCachedDocument(file);
     if (document == null) {
       if (!file.isValid() || file.isDirectory() ||
@@ -174,7 +175,6 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt
         return null;
       }
 
-      ApplicationManager.getApplication().assertReadAccessAllowed();
       final CharSequence text = LoadTextUtil.loadText(file);
       synchronized (lock) {
         document = (DocumentEx)getCachedDocument(file);