From ce8a9647c40aacd14cb51a8f2407b1ecb03fb6f9 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Sat, 23 Mar 2019 16:37:06 +0100 Subject: [PATCH] better fix for IDEA-184506 (cherry picked from commit f9ed8347772531c0008d5f1d1e9a5294ff0d821a) --- .../configurationStore/BinaryXmlWriter.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/platform/projectModel-impl/src/com/intellij/configurationStore/BinaryXmlWriter.kt b/platform/projectModel-impl/src/com/intellij/configurationStore/BinaryXmlWriter.kt index a2ecea7f26d2..dedb42756f64 100644 --- a/platform/projectModel-impl/src/com/intellij/configurationStore/BinaryXmlWriter.kt +++ b/platform/projectModel-impl/src/com/intellij/configurationStore/BinaryXmlWriter.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.configurationStore import com.intellij.util.containers.ObjectIntHashMap @@ -57,9 +57,12 @@ internal class BinaryXmlWriter(private val out: DataOutputStream) { out.writeByte(TypeMarker.CDATA.ordinal) writeString(item.text) } - is Text -> if (!isAllWhitespace(item)) { - out.writeByte(TypeMarker.TEXT.ordinal) - writeString(item.text) + is Text -> { + val text = item.text + if (text != null && !Verifier.isAllXMLWhitespace(text)) { + out.writeByte(TypeMarker.TEXT.ordinal) + writeString(text) + } } } } @@ -107,8 +110,4 @@ internal class BinaryXmlWriter(private val out: DataOutputStream) { else -> throw IllegalArgumentException("Integer out of range: $v") } } - - private fun isAllWhitespace(obj: Text): Boolean { - return obj.text?.all { Verifier.isXMLWhitespace(it) } ?: return true - } } \ No newline at end of file