From ce2dec4ee18cdfb435b093dc35605bfcbf6a6fa9 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 13 Apr 2016 11:44:33 +0300 Subject: [PATCH] fix problem with unexpected null value (following fix for IDEA-154578) --- .../codeInsight/folding/impl/DocumentFoldingInfo.java | 5 +++-- .../util/src/com/intellij/openapi/util/text/StringUtil.java | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java index d60f4bc3ae9d..bbd78f6372f1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java @@ -332,8 +332,9 @@ class DocumentFoldingInfo implements JDOMExternalizable, CodeFoldingState { if (start < 0 || end >= document.getTextLength() || start > end) continue; RangeMarker marker = document.createRangeMarker(start, end); myRangeMarkers.add(marker); - String placeHolderText = StringUtil.unescapeIllegalXmlChars(e.getAttributeValue(PLACEHOLDER_ATT)); - if (placeHolderText == null) placeHolderText = DEFAULT_PLACEHOLDER; + String placeholderAttributeValue = e.getAttributeValue(PLACEHOLDER_ATT); + String placeHolderText = placeholderAttributeValue == null ? DEFAULT_PLACEHOLDER + : StringUtil.unescapeIllegalXmlChars(placeholderAttributeValue); FoldingInfo fi = new FoldingInfo(placeHolderText, expanded); marker.putUserData(FOLDING_INFO_KEY, fi); } diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index b6f5ab65a0e3..b65c9d5ef958 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -2203,6 +2203,7 @@ public class StringUtil extends StringUtilRt { * @see https://www.w3.org/International/questions/qa-controls * @see Verifier#isXMLCharacter(int) */ + @NotNull public static String escapeIllegalXmlChars(@NotNull String text) { StringBuilder b = null; int lastPos = 0; @@ -2226,6 +2227,7 @@ public class StringUtil extends StringUtilRt { /** * @see #escapeIllegalXmlChars(String) */ + @NotNull public static String unescapeIllegalXmlChars(@NotNull String text) { StringBuilder b = null; int lastPos = 0;