mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix tests: do not throw exception on empty extension if in headless or unit-tests mode
This commit is contained in:
+9
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.components.impl.stores;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -48,6 +49,13 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#" + StateStorageManagerImpl.class.getName());
|
||||
|
||||
private static final boolean ourHeadlessEnvironment;
|
||||
|
||||
static {
|
||||
final ApplicationEx ex = ApplicationManagerEx.getApplicationEx();
|
||||
ourHeadlessEnvironment = ex.isHeadlessEnvironment() || ex.isUnitTestMode();
|
||||
}
|
||||
|
||||
private final Map<String, String> myMacros = new HashMap<String, String>();
|
||||
private final Map<String, StateStorage> myStorages = new HashMap<String, StateStorage>();
|
||||
private final Map<String, StateStorage> myPathToStorage = new HashMap<String, StateStorage>();
|
||||
@@ -269,7 +277,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
|
||||
}
|
||||
|
||||
final String extension = FileUtil.getExtension(new File(expandedFile).getName());
|
||||
if (extension.length() == 0) {
|
||||
if (!ourHeadlessEnvironment && extension.length() == 0) {
|
||||
throw new IllegalArgumentException("Extension is missing for storage file: " + expandedFile);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user