diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java index 8350f2fd9e08..122cc01fe328 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java @@ -35,7 +35,6 @@ import com.intellij.util.PlatformUtils; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.util.containers.HashMap; import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.UIUtil; import gnu.trove.THashMap; import org.jdom.Element; import org.jetbrains.annotations.NonNls; @@ -54,6 +53,7 @@ import static com.intellij.openapi.editor.markup.TextAttributes.USE_INHERITED_MA import static com.intellij.openapi.util.Couple.of; import static com.intellij.ui.ColorUtil.fromHex; +@SuppressWarnings("UseJBColor") public abstract class AbstractColorsScheme implements EditorColorsScheme, SerializableScheme { private static final int CURR_VERSION = 142; @@ -422,10 +422,11 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial } continue; } - TextAttributes attr = myValueReader.read(TextAttributes.class, valueElement); - myAttributesMap.put(key, attr); - migrateErrorStripeColorFrom14(key, attr); + if (attr != null) { + myAttributesMap.put(key, attr); + migrateErrorStripeColorFrom14(key, attr); + } } } @@ -522,10 +523,11 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial } private int readFontSize(Element element, boolean isDefault, Float fontScale) { - Float size = (float)myValueReader.read(Integer.class, element); - if (size == null) { + Integer intSize = myValueReader.read(Integer.class, element); + if (intSize == null) { return -1; } + Float size = (float)intSize; if (!isDefault) { size = (fontScale != null) ? size / fontScale : DEFAULT_FONT_SIZE.getSize(); } @@ -562,7 +564,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial parentNode.setAttribute(NAME_ATTR, getName()); parentNode.setAttribute(VERSION_ATTR, Integer.toString(myVersion)); - /** + /* * FONT_SCALE is used to correctly identify the font size in both the JRE-managed HiDPI mode and * the IDE-managed HiDPI mode: {@link UIUtil#isJreHiDPIEnabled()}. Also, it helps to distinguish * the "hidpi-aware" scheme version from the previous one. Namely, the absence of the FONT_SCALE diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/ValueElementReader.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/ValueElementReader.java index 791b622ec74b..bb686942f56c 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/ValueElementReader.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/ValueElementReader.java @@ -20,6 +20,7 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; import org.jdom.Element; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.Nullable; import java.awt.Color; @@ -32,6 +33,7 @@ import java.awt.Color; * * @author Sergey.Malenkov */ +@SuppressWarnings("UseJBColor") class ValueElementReader { @NonNls private static final String VALUE = "value"; @NonNls private static final String MAC = "mac"; @@ -60,6 +62,7 @@ class ValueElementReader { * @param the result type * @return a value or {@code null} if it cannot be read */ + @Nullable public T read(Class type, Element element) { T value = null; if (element != null) {