mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
revert changes to fix problem with saving settings when WriteExternalException is thrown
(cherry picked from commit a6fa4dd)
This commit is contained in:
+3
-4
@@ -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);
|
||||
|
||||
+4
-7
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user