summaryrefslogtreecommitdiff
path: root/platform/core-api/src/com/intellij/ide
diff options
context:
space:
mode:
Diffstat (limited to 'platform/core-api/src/com/intellij/ide')
-rw-r--r--platform/core-api/src/com/intellij/ide/caches/FileContent.java2
-rw-r--r--platform/core-api/src/com/intellij/ide/util/PropertiesComponent.java8
2 files changed, 8 insertions, 2 deletions
diff --git a/platform/core-api/src/com/intellij/ide/caches/FileContent.java b/platform/core-api/src/com/intellij/ide/caches/FileContent.java
index 0933b7f19005..c4c6d61c4513 100644
--- a/platform/core-api/src/com/intellij/ide/caches/FileContent.java
+++ b/platform/core-api/src/com/intellij/ide/caches/FileContent.java
@@ -47,7 +47,7 @@ public class FileContent extends UserDataHolderBase {
@NotNull
public byte[] getBytes() throws IOException {
if (myCachedBytes == null) {
- myCachedBytes = myVirtualFile.contentsToByteArray(false);
+ myCachedBytes = myVirtualFile.isValid() ? myVirtualFile.contentsToByteArray(false) : ArrayUtil.EMPTY_BYTE_ARRAY;
}
return myCachedBytes;
diff --git a/platform/core-api/src/com/intellij/ide/util/PropertiesComponent.java b/platform/core-api/src/com/intellij/ide/util/PropertiesComponent.java
index f3b883d0b60f..f733cd04f4a6 100644
--- a/platform/core-api/src/com/intellij/ide/util/PropertiesComponent.java
+++ b/platform/core-api/src/com/intellij/ide/util/PropertiesComponent.java
@@ -17,8 +17,10 @@ package com.intellij.ide.util;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
+import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
@@ -31,6 +33,7 @@ public abstract class PropertiesComponent {
public abstract boolean isValueSet(String name);
+ @Nullable
public abstract String getValue(@NonNls String name);
public abstract void setValue(@NonNls String name, String value);
@@ -62,7 +65,10 @@ public abstract class PropertiesComponent {
@NotNull
public String getValue(@NonNls String name, @NotNull String defaultValue) {
- return isValueSet(name) ? getValue(name) : defaultValue;
+ if (!isValueSet(name)) {
+ return defaultValue;
+ }
+ return ObjectUtils.notNull(getValue(name), defaultValue);
}
public final int getOrInitInt(@NonNls String name, int defaultValue) {