diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java index 874790f0c6df..75b0999c66ae 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java @@ -163,7 +163,7 @@ public class FileBasedStorage extends XmlElementStorage { @Override protected void doSave() throws StateStorageException { - if (myBlockSavingTheContentCausedByRead || myBlockSavingTheContentCausedByWrite) { + if (myBlockSavingTheContent) { return; } if (ApplicationManager.getApplication().isUnitTestMode() && myFile != null && StringUtil.startsWithChar(myFile.getPath(), '$')) { @@ -248,8 +248,7 @@ public class FileBasedStorage extends XmlElementStorage { @Override @Nullable protected Document loadDocument() throws StateStorageException { - myBlockSavingTheContentCausedByRead = false; - myBlockSavingTheContentCausedByWrite = false; + myBlockSavingTheContent = false; try { VirtualFile file = getVirtualFile(); if (file == null || file.isDirectory() || !file.isValid()) { @@ -272,7 +271,7 @@ public class FileBasedStorage extends XmlElementStorage { @Nullable private Document processReadException(@Nullable final Exception e) { boolean contentTruncated = e == null; - myBlockSavingTheContentCausedByRead = isProjectOrModuleFile() && !contentTruncated; + myBlockSavingTheContent = isProjectOrModuleFile() && !contentTruncated; if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) { if (e != null) { LOG.info(e); diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java index 93992e36f0f6..650419f6381a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java @@ -51,8 +51,7 @@ public abstract class XmlElementStorage implements StateStorage, Disposable { protected final StreamProvider myStreamProvider; protected final String myFileSpec; private final ComponentRoamingManager myComponentRoamingManager; - protected boolean myBlockSavingTheContentCausedByRead = false; - protected boolean myBlockSavingTheContentCausedByWrite = false; + protected boolean myBlockSavingTheContent = false; protected int myUpToDateHash = -1; protected int myProviderUpToDateHash = -1; private boolean mySavingDisabled = false; @@ -271,15 +270,13 @@ public abstract class XmlElementStorage implements StateStorage, Disposable { try { setState(componentName, DefaultStateSerializer.serializeState(state, storageSpec)); - myBlockSavingTheContentCausedByWrite = false; } catch (WriteExternalException e) { - myBlockSavingTheContentCausedByWrite = true; LOG.debug(e); } } - private synchronized void setState(@NotNull String componentName, @NotNull Element element) { + private synchronized void setState(final String componentName, final Element element) { if (element.getAttributes().isEmpty() && element.getChildren().isEmpty()) { return; } @@ -328,7 +325,7 @@ public abstract class XmlElementStorage implements StateStorage, Disposable { } private boolean _needsSave(int hash) { - if (myBlockSavingTheContentCausedByRead || myBlockSavingTheContentCausedByWrite) { + if (myBlockSavingTheContent) { return false; } @@ -377,7 +374,7 @@ public abstract class XmlElementStorage implements StateStorage, Disposable { public final void save() throws StateStorageException { assert mySession == this; - if (myBlockSavingTheContentCausedByRead || myBlockSavingTheContentCausedByWrite) { + if (myBlockSavingTheContent) { return; }