diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/LightJavadocGeneratorTest.kt b/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/LightJavadocGeneratorTest.kt
index 5251395e12d8..40a5c7752182 100644
--- a/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/LightJavadocGeneratorTest.kt
+++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/LightJavadocGeneratorTest.kt
@@ -1,18 +1,4 @@
-/*
- * Copyright 2000-2017 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// 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.
package com.intellij.java.codeInsight.javadoc
import com.intellij.codeInsight.javadoc.JavaDocInfoGeneratorFactory
@@ -20,14 +6,13 @@ import com.intellij.psi.PsiJavaFile
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.assertions.Assertions.assertThat
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
-import com.intellij.util.loadElement
class LightJavadocGeneratorTest : LightCodeInsightFixtureTestCase() {
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_9
fun testPlainModule() = doTestModule("module M.N { }", """
""".trimIndent())
- fun testDocumentedModule() = doTestModule("/** One humble module. */\n@Deprecated\nmodule M.N { }", """@Deprecated
+ fun testDocumentedModule() = doTestModule("/** One humble module. */\n@Deprecated\nmodule M.N { }", """ One humble module.
""".trimIndent())
private fun doTestModule(text: String, expected: String) {
diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt
index f05a1d9dd680..ee1bce9d6587 100644
--- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt
+++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt
@@ -17,6 +17,7 @@ import com.intellij.openapi.project.ProjectManager
import com.intellij.openapi.project.ProjectManagerListener
import com.intellij.openapi.startup.StartupActivity
import com.intellij.openapi.util.Disposer
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.text.StringUtil
import com.intellij.packageDependencies.DependencyValidationManager
import com.intellij.profile.ProfileChangeAdapter
@@ -25,7 +26,6 @@ import com.intellij.psi.search.scope.packageSet.NamedScopeManager
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.getAttributeBooleanValue
-import com.intellij.util.loadElement
import com.intellij.util.xmlb.Accessor
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
import com.intellij.util.xmlb.XmlSerializer
@@ -42,7 +42,7 @@ import java.util.function.Function
private const val VERSION = "1.0"
private const val PROJECT_DEFAULT_PROFILE_NAME = "Project Default"
-private val defaultSchemeDigest = loadElement("""
+private val defaultSchemeDigest = JDOMUtil.load("""
diff --git a/platform/configuration-store-impl/src/FileBasedStorage.kt b/platform/configuration-store-impl/src/FileBasedStorage.kt
index 5f4eb1d361d0..4195c928e969 100644
--- a/platform/configuration-store-impl/src/FileBasedStorage.kt
+++ b/platform/configuration-store-impl/src/FileBasedStorage.kt
@@ -13,6 +13,7 @@ import com.intellij.openapi.components.StoragePathMacros
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.diagnostic.debugOrInfoIfTestMode
import com.intellij.openapi.fileEditor.impl.LoadTextUtil
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.openapi.vfs.LocalFileSystem
@@ -178,7 +179,7 @@ open class FileBasedStorage(file: Path,
else {
val data = file.readChars()
lineSeparator = detectLineSeparators(data, if (isUseXmlProlog) null else LineSeparator.LF)
- return loadElement(data)
+ return JDOMUtil.load(data)
}
return null
}
diff --git a/platform/configuration-store-impl/src/ModuleStateStorageManager.kt b/platform/configuration-store-impl/src/ModuleStateStorageManager.kt
index d73def44ceef..3ea3c8189c07 100644
--- a/platform/configuration-store-impl/src/ModuleStateStorageManager.kt
+++ b/platform/configuration-store-impl/src/ModuleStateStorageManager.kt
@@ -9,9 +9,9 @@ import com.intellij.openapi.module.impl.ModuleManagerImpl
import com.intellij.openapi.module.impl.getModuleNameByFilePath
import com.intellij.openapi.project.ProjectBundle
import com.intellij.openapi.project.isExternalStorageEnabled
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
import com.intellij.util.LineSeparator
-import com.intellij.util.loadElement
import org.jdom.Element
import java.io.FileNotFoundException
import java.nio.ByteBuffer
@@ -100,7 +100,7 @@ internal class ModuleStateStorageManager(macroSubstitutor: TrackingPathMacroSubs
runAndHandleExceptions {
val charBuffer = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(virtualFile.contentsToByteArray()))
lineSeparator = detectLineSeparators(charBuffer, if (isUseXmlProlog) null else LineSeparator.LF)
- return loadElement(charBuffer)
+ return JDOMUtil.load(charBuffer)
}
}
return null
diff --git a/platform/configuration-store-impl/src/XmlElementStorage.kt b/platform/configuration-store-impl/src/XmlElementStorage.kt
index 7f85ba2a4c11..89a287422097 100644
--- a/platform/configuration-store-impl/src/XmlElementStorage.kt
+++ b/platform/configuration-store-impl/src/XmlElementStorage.kt
@@ -16,7 +16,6 @@ import com.intellij.util.LineSeparator
import com.intellij.util.SmartList
import com.intellij.util.containers.SmartHashSet
import com.intellij.util.io.delete
-import com.intellij.util.loadElement
import gnu.trove.THashMap
import org.jdom.Attribute
import org.jdom.Element
@@ -51,7 +50,7 @@ abstract class XmlElementStorage protected constructor(val fileSpec: String,
if (useStreamProvider && provider != null) {
isLoadLocalData = !provider.read(fileSpec, roamingType) { inputStream ->
inputStream?.let {
- element = loadElement(inputStream)
+ element = JDOMUtil.load(inputStream)
providerDataStateChanged(createDataWriterForElement(element!!, toString()), DataStateChanged.LOADED)
}
}
diff --git a/platform/configuration-store-impl/testSrc/BinaryXmlOutputterTest.kt b/platform/configuration-store-impl/testSrc/BinaryXmlOutputterTest.kt
index 9bcd891d8514..a89b076296ad 100644
--- a/platform/configuration-store-impl/testSrc/BinaryXmlOutputterTest.kt
+++ b/platform/configuration-store-impl/testSrc/BinaryXmlOutputterTest.kt
@@ -3,7 +3,6 @@ package com.intellij.configurationStore
import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream
-import com.intellij.util.loadElement
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
@@ -78,7 +77,7 @@ class BinaryXmlOutputterTest {
private fun test(xml: String) {
val byteOut = BufferExposingByteArrayOutputStream()
byteOut.use {
- serializeElementToBinary(loadElement(xml), it)
+ serializeElementToBinary(JDOMUtil.load(xml), it)
}
val xmlAfter = JDOMUtil.writeElement(byteOut.toByteArray().inputStream().use { deserializeElementFromBinary(it) })
diff --git a/platform/configuration-store-impl/testSrc/CodeStyleTest.kt b/platform/configuration-store-impl/testSrc/CodeStyleTest.kt
index 445b9d829ac8..fba0d1f14798 100644
--- a/platform/configuration-store-impl/testSrc/CodeStyleTest.kt
+++ b/platform/configuration-store-impl/testSrc/CodeStyleTest.kt
@@ -1,3 +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.
package com.intellij.configurationStore
import com.intellij.openapi.Disposable
@@ -10,7 +11,6 @@ import com.intellij.psi.codeStyle.CustomCodeStyleSettings
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.testFramework.ProjectRule
import com.intellij.util.containers.ContainerUtil
-import com.intellij.util.loadElement
import org.assertj.core.api.Assertions.assertThat
import org.jdom.Element
import org.junit.ClassRule
@@ -43,7 +43,7 @@ class CodeStyleTest {
""".trimIndent()
- settings.readExternal(loadElement(loaded))
+ settings.readExternal(JDOMUtil.load(loaded))
val serialized = Element("code_scheme").setAttribute("name", "testSchemeName")
settings.writeExternal(serialized)
@@ -75,7 +75,7 @@ class CodeStyleTest {
extra = Element(tagName)
parentElement.addContent(extra)
}
-
+
val option = Element("option")
option.setAttribute("name", "MAIN")
option.setAttribute("value", "3")
@@ -103,7 +103,7 @@ class CodeStyleTest {
try {
val settings = CodeStyleSettings()
- val text : (param: String) -> String = { param ->
+ val text : (param: String) -> String = { param ->
"""
@@ -126,7 +126,7 @@ class CodeStyleTest {
""".trimIndent()
}
- settings.readExternal(loadElement(text("2")))
+ settings.readExternal(JDOMUtil.load(text("2")))
val serialized = Element("code_scheme").setAttribute("name", "testSchemeName")
settings.writeExternal(serialized)
@@ -149,7 +149,7 @@ class CodeStyleTest {
""".trimIndent();
- settings.readExternal(loadElement(initial))
+ settings.readExternal(JDOMUtil.load(initial))
settings.resetDeprecatedFields()
val serialized = Element("code_scheme").setAttribute("name", "testSchemeName")
diff --git a/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt b/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt
index ae003de27e46..bd6094038193 100644
--- a/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt
+++ b/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt
@@ -9,6 +9,7 @@ import com.intellij.openapi.application.ex.PathManagerEx
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.components.*
import com.intellij.openapi.project.ProjectManager
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.refreshVfs
import com.intellij.testFramework.*
@@ -95,7 +96,8 @@ internal class DefaultProjectStoreTest {
@Test fun `new project from default - directory-based storage`() {
val defaultProject = ProjectManager.getInstance().defaultProject
val defaultTestComponent = TestComponent()
- defaultTestComponent.loadState(loadElement(""" """))
+ defaultTestComponent.loadState(
+ JDOMUtil.load(""" """))
val stateStore = defaultProject.stateStore as ComponentStoreImpl
stateStore.initComponent(defaultTestComponent, true)
try {
diff --git a/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt b/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt
index fc6445e1dd0d..23760fdc78d0 100644
--- a/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt
+++ b/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt
@@ -4,12 +4,12 @@ package com.intellij.configurationStore
import com.intellij.idea.Bombed
import com.intellij.openapi.components.MainConfigurationStateSplitter
import com.intellij.openapi.components.StateStorage
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.ProjectRule
import com.intellij.testFramework.RuleChain
import com.intellij.testFramework.TemporaryDirectory
import com.intellij.testFramework.assertions.Assertions.assertThat
import com.intellij.testFramework.runInEdtAndWait
-import com.intellij.util.loadElement
import org.jdom.Element
import org.junit.ClassRule
import org.junit.Rule
@@ -24,7 +24,7 @@ private fun StateStorage.SaveSessionProducer.save() {
private fun StateStorageBase<*>.setStateAndSave(componentName: String, state: String?) {
val externalizationSession = createSaveSessionProducer()!!
- externalizationSession.setState(null, componentName, if (state == null) Element("state") else loadElement(state))
+ externalizationSession.setState(null, componentName, if (state == null) Element("state") else JDOMUtil.load(state))
externalizationSession.save()
}
diff --git a/platform/configuration-store-impl/testSrc/StoredPropertyStateTest.kt b/platform/configuration-store-impl/testSrc/StoredPropertyStateTest.kt
index 5030a720ebf7..e4f1234a0ca5 100644
--- a/platform/configuration-store-impl/testSrc/StoredPropertyStateTest.kt
+++ b/platform/configuration-store-impl/testSrc/StoredPropertyStateTest.kt
@@ -2,8 +2,8 @@
package com.intellij.configurationStore
import com.intellij.openapi.components.BaseState
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.assertions.Assertions.assertThat
-import com.intellij.util.loadElement
import com.intellij.util.xmlb.annotations.Attribute
import com.intellij.util.xmlb.annotations.CollectionBean
import org.junit.Test
@@ -74,7 +74,7 @@ class StoredPropertyStateTest {
assertThat(state).isEqualTo(newEqualState)
assertThat(state.serialize()).isEqualTo(""" """)
- assertThat(loadElement(""" """).deserialize(AState::class.java).languageLevel).isEqualTo("foo")
+ assertThat(JDOMUtil.load(""" """).deserialize(AState::class.java).languageLevel).isEqualTo("foo")
}
@Test
diff --git a/platform/configuration-store-impl/testSrc/xml/KotlinXmlSerializerTest.kt b/platform/configuration-store-impl/testSrc/xml/KotlinXmlSerializerTest.kt
index 490e31d1e1d3..2c6c1d573666 100644
--- a/platform/configuration-store-impl/testSrc/xml/KotlinXmlSerializerTest.kt
+++ b/platform/configuration-store-impl/testSrc/xml/KotlinXmlSerializerTest.kt
@@ -4,7 +4,7 @@ package com.intellij.configurationStore.xml
import com.intellij.configurationStore.AState
import com.intellij.configurationStore.deserialize
import com.intellij.openapi.components.BaseState
-import com.intellij.util.loadElement
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.util.xmlb.annotations.MapAnnotation
import com.intellij.util.xmlb.annotations.Property
import com.intellij.util.xmlb.annotations.Tag
@@ -86,25 +86,25 @@ class KotlinXmlSerializerTest {
""", data)
- assertThat(loadElement("""
-
-
-
-
-
-
-
- """).deserialize().PLACES_MAP.get("")!!.IGNORE_POLICY).isEqualTo(IgnorePolicy.DEFAULT)
+ assertThat(JDOMUtil.load("""
+
+
+
+
+
+
+
+ """).deserialize().PLACES_MAP.get("")!!.IGNORE_POLICY).isEqualTo(IgnorePolicy.DEFAULT)
- val value = loadElement("""
-
-
-
-
-
-
-
- """).deserialize()
+ val value = JDOMUtil.load("""
+
+
+
+
+
+
+
+ """).deserialize()
assertThat(value).isNotNull()
val placeSettings = value.PLACES_MAP.get("")
assertThat(placeSettings).isNotNull()
diff --git a/platform/configuration-store-impl/testSrc/xml/XmlSerializerCollectionTest.kt b/platform/configuration-store-impl/testSrc/xml/XmlSerializerCollectionTest.kt
index f6b196f50659..c6f58c41b7be 100644
--- a/platform/configuration-store-impl/testSrc/xml/XmlSerializerCollectionTest.kt
+++ b/platform/configuration-store-impl/testSrc/xml/XmlSerializerCollectionTest.kt
@@ -9,7 +9,6 @@ import com.intellij.openapi.util.JDOMExternalizableStringList
import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.assertions.Assertions.assertThat
import com.intellij.util.SmartList
-import com.intellij.util.loadElement
import com.intellij.util.xmlb.SkipDefaultsSerializationFilter
import com.intellij.util.xmlb.XmlSerializer
import com.intellij.util.xmlb.annotations.AbstractCollection
@@ -212,76 +211,76 @@ internal class XmlSerializerCollectionTest {
}
@Test fun testPropertyAndNoSurround() {
- val bean = XmlSerializer.deserialize(loadElement("""
- com.intellij.database.ide
- DataGrip Customization
- JetBrains
- Database
+ val bean = XmlSerializer.deserialize(JDOMUtil.load("""
+ com.intellij.database.ide
+ DataGrip Customization
+ JetBrains
+ Database
- com.intellij.modules.datagrip
- com.intellij.database
+ com.intellij.modules.datagrip
+ com.intellij.database
-
-
-
-
+
+
+
+
-
+
+
+
-
-
-
-
-
+
-
-
- com.intellij.database.ide.DataGripInitialConfigurator
-
-
-
+
+
+ com.intellij.database.ide.DataGripInitialConfigurator
+
+
+
-
-
-
- com.intellij.database.autoConfig.DatabaseConfigFileWatcher
-
-
-
+
+
+
+ com.intellij.database.autoConfig.DatabaseConfigFileWatcher
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
- """), PluginBean::class.java)
+
+
+ """), PluginBean::class.java)
assertThat(bean.actions.joinToString("\n") { JDOMUtil.writeElement(it) }).isEqualTo("""
diff --git a/platform/configuration-store-impl/testSrc/xml/XmlSerializerTest.kt b/platform/configuration-store-impl/testSrc/xml/XmlSerializerTest.kt
index 8a44826adfe3..c88517781988 100644
--- a/platform/configuration-store-impl/testSrc/xml/XmlSerializerTest.kt
+++ b/platform/configuration-store-impl/testSrc/xml/XmlSerializerTest.kt
@@ -7,11 +7,11 @@ import com.intellij.configurationStore.StoredPropertyStateTest
import com.intellij.configurationStore.clearBindingCache
import com.intellij.configurationStore.deserialize
import com.intellij.configurationStore.serialize
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.text.StringUtil
import com.intellij.testFramework.UsefulTestCase
import com.intellij.testFramework.assertConcurrent
import com.intellij.testFramework.assertions.Assertions.assertThat
-import com.intellij.util.loadElement
import com.intellij.util.xmlb.*
import com.intellij.util.xmlb.annotations.*
import junit.framework.TestCase
@@ -421,13 +421,13 @@ internal class XmlSerializerTest {
}
@Test fun deserializeFromFormattedXML() {
- val bean = loadElement("""
-
-
-
-
-
- """).deserialize()
+ val bean = JDOMUtil.load("""
+
+
+
+
+
+ """).deserialize()
assertThat(bean.intV).isEqualTo(2)
assertThat("[1, 2, 3]").isEqualTo(Arrays.asList(*bean.v).toString())
}
@@ -502,7 +502,8 @@ internal class XmlSerializerTest {
}
@Test fun deserializeJDOMElementField() {
- val bean = loadElement(" ").deserialize()
+ val bean = JDOMUtil.load(
+ " ").deserialize()
assertThat(bean.STRING_V).isEqualTo("bye")
assertThat(bean.actions).isNotNull
@@ -516,7 +517,7 @@ internal class XmlSerializerTest {
@Test fun jdomElementArrayField() {
val text = "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " "
- val bean = loadElement(text).deserialize()
+ val bean = JDOMUtil.load(text).deserialize()
TestCase.assertEquals("bye", bean.STRING_V)
TestCase.assertNotNull(bean.actions)
@@ -609,7 +610,8 @@ internal class XmlSerializerTest {
val bean = BeanWithPublicFields()
bean.STRING_V = "zzz"
- XmlSerializer.deserializeInto(bean, loadElement(" "))
+ XmlSerializer.deserializeInto(bean,
+ JDOMUtil.load(" "))
assertThat(bean.INT_V).isEqualTo(999)
assertThat(bean.STRING_V).isEqualTo("zzz")
@@ -654,16 +656,16 @@ internal class XmlSerializerTest {
@Tag("bean")
data class Bean(@Tag val description: String? = null)
- var bean = loadElement("""
-
- Node.js integration
- ]]>
-
- """).deserialize()
+ var bean = JDOMUtil.load("""
+
+ Node.js integration
+ ]]>
+
+ """).deserialize()
assertThat(bean.description).isEqualToIgnoringWhitespace("Node.js integration ")
- bean = loadElement("""Node.js integration]]> """).deserialize()
+ bean = JDOMUtil.load("""Node.js integration]]> """).deserialize()
assertThat(bean.description).isEqualTo("Node.js integration ")
}
diff --git a/platform/credential-store/src/kdbx/KeePassDatabase.kt b/platform/credential-store/src/kdbx/KeePassDatabase.kt
index f1ce7a12957a..44e4a79f7d85 100644
--- a/platform/credential-store/src/kdbx/KeePassDatabase.kt
+++ b/platform/credential-store/src/kdbx/KeePassDatabase.kt
@@ -4,9 +4,9 @@ package com.intellij.credentialStore.kdbx
import com.intellij.credentialStore.OneTimeString
import com.intellij.credentialStore.createSecureRandom
import com.intellij.credentialStore.generateBytes
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.util.getOrCreate
import com.intellij.util.io.toByteArray
-import com.intellij.util.loadElement
import org.bouncycastle.crypto.SkippingStreamCipher
import org.bouncycastle.crypto.engines.ChaCha7539Engine
import org.bouncycastle.crypto.params.KeyParameter
@@ -179,42 +179,42 @@ private fun base64FromUuid(uuid: UUID): String {
private fun createEmptyDatabase(): Element {
val creationDate = formattedNow()
@Suppress("SpellCheckingInspection")
- return loadElement("""
-
- IJ
-
- New Database
- ${creationDate}
- Empty Database
- ${creationDate}
-
- ${creationDate}
- 365
-
- ${creationDate}
- -1
- -1
-
- False
- False
- True
- False
- False
-
-
- True
- AAAAAAAAAAAAAAAAAAAAAA==
- ${creationDate}
- AAAAAAAAAAAAAAAAAAAAAA==
- ${creationDate}
- AAAAAAAAAAAAAAAAAAAAAA==
- AAAAAAAAAAAAAAAAAAAAAA==
- 10
- 6291456
-
-
-
- """)
+ return JDOMUtil.load("""
+
+ IJ
+
+ New Database
+ ${creationDate}
+ Empty Database
+ ${creationDate}
+
+ ${creationDate}
+ 365
+
+ ${creationDate}
+ -1
+ -1
+
+ False
+ False
+ True
+ False
+ False
+
+
+ True
+ AAAAAAAAAAAAAAAAAAAAAA==
+ ${creationDate}
+ AAAAAAAAAAAAAAAAAAAAAA==
+ ${creationDate}
+ AAAAAAAAAAAAAAAAAAAAAA==
+ AAAAAAAAAAAAAAAAAAAAAA==
+ 10
+ 6291456
+
+
+
+ """)
}
internal class StringProtectedByStreamCipher(value: ByteArray, private val cipher: SkippingStreamCipher) : SecureString {
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/configurationStore/PersistentMapManager.kt b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/configurationStore/PersistentMapManager.kt
index a5a677bc7452..e19ffa2c9367 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/configurationStore/PersistentMapManager.kt
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/configurationStore/PersistentMapManager.kt
@@ -6,8 +6,8 @@ import com.intellij.configurationStore.DataWriterFilter
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsDataStorage
import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.util.io.*
-import com.intellij.util.loadElement
import org.jdom.Element
import java.nio.file.Path
@@ -80,7 +80,7 @@ internal abstract class FileSystemExternalSystemStorage(dirName: String, project
}
return nameToPath(name).inputStreamIfExists()?.use {
- loadElement(it)
+ JDOMUtil.load(it)
}
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/project/loadSaveModuleRenameMapping.kt b/platform/platform-impl/src/com/intellij/ide/actions/project/loadSaveModuleRenameMapping.kt
index 0feb3520606e..e2fc4c80be4e 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/project/loadSaveModuleRenameMapping.kt
+++ b/platform/platform-impl/src/com/intellij/ide/actions/project/loadSaveModuleRenameMapping.kt
@@ -1,4 +1,4 @@
-// Copyright 2000-2017 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-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.
package com.intellij.ide.actions.project
import com.intellij.CommonBundle
@@ -14,10 +14,10 @@ import com.intellij.openapi.module.impl.ModuleRenamingHistoryState
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectBundle
import com.intellij.openapi.ui.Messages
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.wm.IdeFocusManager
-import com.intellij.util.loadElement
import com.intellij.util.ui.UIUtil
import com.intellij.util.write
import com.intellij.util.xmlb.XmlSerializationException
@@ -42,7 +42,7 @@ class LoadModuleRenamingSchemeAction(private val dialog: ConvertModuleGroupsToQu
}
val renamingState = try {
- XmlSerializer.deserialize(loadElement(file.inputStream), ModuleRenamingHistoryState::class.java)
+ XmlSerializer.deserialize(JDOMUtil.load(file.inputStream), ModuleRenamingHistoryState::class.java)
}
catch (e: XmlSerializationException) {
LOG.info(e)
diff --git a/platform/platform-impl/src/com/intellij/internal/ShowUpdateInfoDialogAction.kt b/platform/platform-impl/src/com/intellij/internal/ShowUpdateInfoDialogAction.kt
index 55733cbdd9e4..45873ca11035 100644
--- a/platform/platform-impl/src/com/intellij/internal/ShowUpdateInfoDialogAction.kt
+++ b/platform/platform-impl/src/com/intellij/internal/ShowUpdateInfoDialogAction.kt
@@ -12,8 +12,8 @@ import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.*
import com.intellij.openapi.updateSettings.impl.UpdateChecker
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.ui.ScrollPaneFactory
-import com.intellij.util.loadElement
import com.intellij.util.text.nullize
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
@@ -88,7 +88,9 @@ class ShowUpdateInfoDialogAction : DumbAwareAction() {
return ValidationInfo("Please paste something here", textArea)
}
- try { loadElement(completeUpdateInfoXml(text)) }
+ try {
+ JDOMUtil.load(completeUpdateInfoXml(text))
+ }
catch (e: Exception) {
return ValidationInfo(e.message ?: "Error: ${e.javaClass.name}", textArea)
}
@@ -104,7 +106,7 @@ class ShowUpdateInfoDialogAction : DumbAwareAction() {
internal fun patchFilePath() = fileField.field.text.nullize(nullizeSpaces = true)
private fun completeUpdateInfoXml(text: String) =
- when (loadElement(text).name) {
+ when (JDOMUtil.load(text).name) {
"products" -> text
"channel" -> {
val productName = ApplicationNamesInfo.getInstance().fullProductName
diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/DefaultKeymap.kt b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/DefaultKeymap.kt
index 6cc8bba02b60..49ec260f387d 100644
--- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/DefaultKeymap.kt
+++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/DefaultKeymap.kt
@@ -7,8 +7,8 @@ import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.runAndLogException
import com.intellij.openapi.keymap.Keymap
import com.intellij.openapi.keymap.KeymapManager
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.SystemInfo
-import com.intellij.util.loadElement
import gnu.trove.THashMap
import org.jdom.Element
import java.util.*
@@ -48,7 +48,7 @@ open class DefaultKeymap {
LOG.runAndLogException {
loadKeymapsFromElement(object: SchemeDataHolder {
- override fun read() = provider.load(key) { loadElement(it) }
+ override fun read() = provider.load(key) { JDOMUtil.load(it) }
override fun updateDigest(scheme: KeymapImpl) {
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt
index 5b1aacb278a7..270fa5a39ff2 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.ProjectManager
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.util.ActionCallback
import com.intellij.openapi.util.BuildNumber
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.text.StringUtil
@@ -34,7 +35,6 @@ import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.MultiMap
import com.intellij.util.io.HttpRequests
import com.intellij.util.io.URLUtil
-import com.intellij.util.loadElement
import com.intellij.util.ui.UIUtil
import com.intellij.xml.util.XmlStringUtil
import gnu.trove.THashMap
@@ -169,7 +169,7 @@ object UpdateChecker {
.connect {
try {
if (settings.isPlatformUpdateEnabled)
- UpdatesInfo(loadElement(it.reader))
+ UpdatesInfo(JDOMUtil.load(it.reader))
else
null
}
@@ -203,7 +203,7 @@ object UpdateChecker {
.forceHttps(settings.canUseSecureConnection())
.connect {
try {
- UpdatesInfo(loadElement(it.reader))
+ UpdatesInfo(JDOMUtil.load(it.reader))
}
catch (e: JDOMException) {
// corrupted content, don't bother telling user
@@ -543,13 +543,13 @@ object UpdateChecker {
val newBuild: BuildInfo?
val patches: UpdateChain?
if (forceUpdate) {
- val node = loadElement(updateInfoText).getChild("product")?.getChild("channel") ?: throw IllegalArgumentException("//channel missing")
+ val node = JDOMUtil.load(updateInfoText).getChild("product")?.getChild("channel") ?: throw IllegalArgumentException("//channel missing")
channel = UpdateChannel(node)
newBuild = channel.builds.firstOrNull() ?: throw IllegalArgumentException("//build missing")
patches = newBuild.patches.firstOrNull()?.let { UpdateChain(listOf(it.fromBuild, newBuild.number), it.size) }
}
else {
- val updateInfo = UpdatesInfo(loadElement(updateInfoText))
+ val updateInfo = UpdatesInfo(JDOMUtil.load(updateInfoText))
val strategy = UpdateStrategy(ApplicationInfo.getInstance().build, updateInfo)
val checkForUpdateResult = strategy.checkForUpdates()
channel = checkForUpdateResult.updatedChannel
diff --git a/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateInfoParsingTest.kt b/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateInfoParsingTest.kt
index f84de19d89c0..08d93137dcb2 100644
--- a/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateInfoParsingTest.kt
+++ b/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateInfoParsingTest.kt
@@ -1,11 +1,11 @@
-// Copyright 2000-2017 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-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.
package com.intellij.ide.updates
import com.intellij.openapi.updateSettings.impl.ChannelStatus
import com.intellij.openapi.updateSettings.impl.UpdateChannel
import com.intellij.openapi.updateSettings.impl.UpdatesInfo
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
-import com.intellij.util.loadElement
import org.junit.Assume.assumeTrue
import org.junit.Test
import java.io.IOException
@@ -119,5 +119,5 @@ class UpdateInfoParsingTest : BareTestFixtureTestCase() {
assertEquals("162.99.2", buildInfo.patches[0].fromBuild.asStringWithoutProductCode())
}
- private fun load(text: String) = UpdatesInfo(loadElement(text))
+ private fun load(text: String) = UpdatesInfo(JDOMUtil.load(text))
}
\ No newline at end of file
diff --git a/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateStrategyTest.kt b/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateStrategyTest.kt
index 16fb5a231ed7..e2eb1be8675f 100644
--- a/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateStrategyTest.kt
+++ b/platform/platform-tests/testSrc/com/intellij/ide/updates/UpdateStrategyTest.kt
@@ -3,8 +3,8 @@ package com.intellij.ide.updates
import com.intellij.openapi.updateSettings.impl.*
import com.intellij.openapi.util.BuildNumber
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
-import com.intellij.util.loadElement
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
@@ -268,13 +268,13 @@ class UpdateStrategyTest : BareTestFixtureTestCase() {
selectedChannel: ChannelStatus,
testData: String,
ignoredBuilds: List = emptyList()): CheckForUpdateResult {
- val updates = UpdatesInfo(loadElement("""
-
-
- IU
- ${testData}
-
- """))
+ val updates = UpdatesInfo(JDOMUtil.load("""
+
+
+ IU
+ ${testData}
+
+ """))
val settings = UpdateSettings()
settings.selectedChannelStatus = selectedChannel
settings.ignoredBuildNumbers += ignoredBuilds
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/updateSettings/UpdateOptionsTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/updateSettings/UpdateOptionsTest.kt
index 3e13a31fb9c5..11d6ee3325b7 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/updateSettings/UpdateOptionsTest.kt
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/updateSettings/UpdateOptionsTest.kt
@@ -3,9 +3,9 @@ package com.intellij.openapi.updateSettings
import com.intellij.configurationStore.deserialize
import com.intellij.openapi.updateSettings.impl.UpdateOptions
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.ProjectRule
import com.intellij.testFramework.assertions.Assertions.assertThat
-import com.intellij.util.loadElement
import org.junit.ClassRule
import org.junit.Test
@@ -24,20 +24,20 @@ class UpdateOptionsTest {
@Test
fun test() {
- loadElement("""
-
-
-
-
-
-
-
-
-
-
-
-
-
- """).deserialize(UpdateOptions::class.java)
+ JDOMUtil.load("""
+
+
+
+
+
+
+
+
+
+
+
+
+
+ """).deserialize(UpdateOptions::class.java)
}
}
\ No newline at end of file
diff --git a/platform/platform-tests/testSrc/com/intellij/util/JDOMUtilTest.kt b/platform/platform-tests/testSrc/com/intellij/util/JDOMUtilTest.kt
index 5bcfcf60644d..a56a254f5ae2 100644
--- a/platform/platform-tests/testSrc/com/intellij/util/JDOMUtilTest.kt
+++ b/platform/platform-tests/testSrc/com/intellij/util/JDOMUtilTest.kt
@@ -1,3 +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.
package com.intellij.util
import com.intellij.openapi.util.JDOMUtil
@@ -31,22 +32,22 @@ internal class JDOMUtilTest {
@Test
fun deepMerge() {
assertThat(JDOMUtil.deepMerge(
- loadElement("""
-
-
-
-
-
-
- """),
- loadElement("""
-
-
-
-
-
-
- """)))
+ JDOMUtil.load("""
+
+
+
+
+
+
+ """),
+ JDOMUtil.load("""
+
+
+
+
+
+
+ """)))
.isEqualTo("""
@@ -62,14 +63,14 @@ internal class JDOMUtilTest {
@Test
fun `deepMerge override empty tag`() {
assertThat(JDOMUtil.deepMerge(
- loadElement("""
-
- """),
- loadElement("""
-
-
-
- """)))
+ JDOMUtil.load("""
+
+ """),
+ JDOMUtil.load("""
+
+
+
+ """)))
.isEqualTo("""
diff --git a/platform/projectModel-api/src/com/intellij/util/jdom.kt b/platform/projectModel-api/src/com/intellij/util/jdom.kt
index 069ce6e3b8b8..428eb881c82a 100644
--- a/platform/projectModel-api/src/com/intellij/util/jdom.kt
+++ b/platform/projectModel-api/src/com/intellij/util/jdom.kt
@@ -40,16 +40,19 @@ fun Parent.write(output: OutputStream, lineSeparator: String = "\n") {
}
@Throws(IOException::class, JDOMException::class)
+@Deprecated("Use JDOMUtil.load directly", ReplaceWith("JDOMUtil.load(chars)", "com.intellij.openapi.util.JDOMUtil"))
fun loadElement(chars: CharSequence): Element = JDOMUtil.load(chars)
@Throws(IOException::class, JDOMException::class)
+@Deprecated("Use JDOMUtil.load directly", ReplaceWith("JDOMUtil.load(reader)", "com.intellij.openapi.util.JDOMUtil"))
fun loadElement(reader: Reader): Element = JDOMUtil.load(reader)
@Throws(IOException::class, JDOMException::class)
-fun loadElement(stream: InputStream): Element = JDOMUtil.load(stream.bufferedReader())
+@Deprecated("Use JDOMUtil.load directly", ReplaceWith("JDOMUtil.load(stream)", "com.intellij.openapi.util.JDOMUtil"))
+fun loadElement(stream: InputStream): Element = JDOMUtil.load(stream)
@Throws(IOException::class, JDOMException::class)
-fun loadElement(path: Path): Element = loadElement(path.inputStream())
+fun loadElement(path: Path): Element = JDOMUtil.load(path.inputStream())
fun Element?.isEmpty(): Boolean = this == null || JDOMUtil.isEmpty(this)
diff --git a/platform/projectModel-impl/src/com/intellij/configurationStore/SchemeManagerIprProvider.kt b/platform/projectModel-impl/src/com/intellij/configurationStore/SchemeManagerIprProvider.kt
index 0e52946e1aa0..f2f0e7faafd8 100644
--- a/platform/projectModel-impl/src/com/intellij/configurationStore/SchemeManagerIprProvider.kt
+++ b/platform/projectModel-impl/src/com/intellij/configurationStore/SchemeManagerIprProvider.kt
@@ -2,9 +2,13 @@
package com.intellij.configurationStore
import com.intellij.openapi.components.RoamingType
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.io.FileUtil
-import com.intellij.util.*
+import com.intellij.util.ArrayUtil
+import com.intellij.util.PathUtilRt
+import com.intellij.util.isEmpty
import com.intellij.util.text.UniqueNameGenerator
+import com.intellij.util.toByteArray
import org.jdom.Element
import java.io.InputStream
import java.util.*
@@ -106,7 +110,7 @@ class SchemeManagerIprProvider(private val subStateTagName: String, private val
names.sortWith(comparator)
}
for (name in names) {
- nameToData.get(name)?.let { state.addContent(loadElement(it.inputStream())) }
+ nameToData.get(name)?.let { state.addContent(JDOMUtil.load(it.inputStream())) }
}
}
}
diff --git a/platform/testFramework/extensions/src/com/intellij/testFramework/runUtil.kt b/platform/testFramework/extensions/src/com/intellij/testFramework/runUtil.kt
index 71d2159ddac2..b7af42f95e8b 100644
--- a/platform/testFramework/extensions/src/com/intellij/testFramework/runUtil.kt
+++ b/platform/testFramework/extensions/src/com/intellij/testFramework/runUtil.kt
@@ -6,8 +6,8 @@ import com.intellij.execution.configurations.RunConfiguration
import com.intellij.execution.impl.deserializeConfigurationFrom
import com.intellij.execution.impl.serializeConfigurationInto
import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.assertions.Assertions.assertThat
-import com.intellij.util.loadElement
import org.jdom.Element
import org.jetbrains.annotations.TestOnly
@@ -20,7 +20,7 @@ fun checkRunConfigurationSerialization(configuration: RunConfiguration, expected
if (factory != null) {
val c2 = factory.createTemplateConfiguration(project)
- deserializeConfigurationFrom(c2, loadElement(expected))
+ deserializeConfigurationFrom(c2, JDOMUtil.load(expected))
checkRunConfigurationSerialization(c2, expected, null, project)
}
}
\ No newline at end of file
diff --git a/plugins/devkit/devkit-core/src/actions/MigrateModuleNamesInSourcesAction.kt b/plugins/devkit/devkit-core/src/actions/MigrateModuleNamesInSourcesAction.kt
index dbc4a6fe1801..96e0d4b4db23 100644
--- a/plugins/devkit/devkit-core/src/actions/MigrateModuleNamesInSourcesAction.kt
+++ b/plugins/devkit/devkit-core/src/actions/MigrateModuleNamesInSourcesAction.kt
@@ -15,6 +15,7 @@ import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Factory
+import com.intellij.openapi.util.JDOMUtil
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VfsUtil
@@ -26,7 +27,6 @@ import com.intellij.psi.search.*
import com.intellij.usageView.UsageInfo
import com.intellij.usages.*
import com.intellij.util.Processor
-import com.intellij.util.loadElement
import com.intellij.util.xmlb.XmlSerializationException
import com.intellij.util.xmlb.XmlSerializer
import org.jetbrains.idea.devkit.util.PsiUtil
@@ -59,7 +59,7 @@ class MigrateModuleNamesInSourcesAction : AnAction("Find/Update Module Names in
val renamingScheme = try {
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(
File(VfsUtil.virtualToIoFile(project.baseDir), "module-renaming-scheme.xml"))?.let {
- XmlSerializer.deserialize(loadElement(it.inputStream), ModuleRenamingHistoryState::class.java).oldToNewName
+ XmlSerializer.deserialize(JDOMUtil.load(it.inputStream), ModuleRenamingHistoryState::class.java).oldToNewName
}
}
catch (e: XmlSerializationException) {