From bb03983d9a5cb3012bff0fbe03ac40ac0180d008 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 14 Feb 2017 16:59:26 +0100 Subject: [PATCH] make loadDocument(@NotNull Reader reader) private --- .../intellij/jarFinder/SourceSearcher.java | 28 ++++++++++++++----- .../src/com/intellij/util/jdom.kt | 2 ++ .../com/intellij/openapi/util/JDOMUtil.java | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java b/java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java index 3533f1a4bb21..4279ec53191f 100644 --- a/java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java +++ b/java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java @@ -1,13 +1,27 @@ +/* + * 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. + */ package com.intellij.jarFinder; import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.util.JDOMUtil; -import com.intellij.openapi.util.io.StreamUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.JdomKt; import com.intellij.util.io.HttpRequests; -import org.jdom.Document; +import org.jdom.Element; import org.jdom.JDOMException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,14 +66,14 @@ public abstract class SourceSearcher { } @NotNull - protected static Document readDocumentCancelable(final ProgressIndicator indicator, String url) throws IOException { + protected static Element readDocumentCancelable(final ProgressIndicator indicator, String url) throws IOException { return HttpRequests.request(url) .accept("application/xml") - .connect(new HttpRequests.RequestProcessor() { + .connect(new HttpRequests.RequestProcessor() { @Override - public Document process(@NotNull HttpRequests.Request request) throws IOException { + public Element process(@NotNull HttpRequests.Request request) throws IOException { try { - return JDOMUtil.loadDocument(request.getReader(indicator)); + return JdomKt.loadElement(request.getReader(indicator)); } catch (JDOMException e) { throw new IOException(e); diff --git a/platform/projectModel-api/src/com/intellij/util/jdom.kt b/platform/projectModel-api/src/com/intellij/util/jdom.kt index 016502e77c4d..e6dc40efd875 100644 --- a/platform/projectModel-api/src/com/intellij/util/jdom.kt +++ b/platform/projectModel-api/src/com/intellij/util/jdom.kt @@ -69,8 +69,10 @@ fun Parent.write(file: Path, lineSeparator: String = "\n") { @Throws(IOException::class, JDOMException::class) fun loadElement(chars: CharSequence) = loadElement(CharSequenceReader(chars)) +@Throws(IOException::class, JDOMException::class) fun loadElement(reader: Reader): Element = loadDocument(reader).detachRootElement() +@Throws(IOException::class, JDOMException::class) fun loadElement(stream: InputStream): Element = loadDocument(stream.reader()).detachRootElement() @Throws(IOException::class, JDOMException::class) diff --git a/platform/util/src/com/intellij/openapi/util/JDOMUtil.java b/platform/util/src/com/intellij/openapi/util/JDOMUtil.java index b2aa347b9088..18639c249bf7 100644 --- a/platform/util/src/com/intellij/openapi/util/JDOMUtil.java +++ b/platform/util/src/com/intellij/openapi/util/JDOMUtil.java @@ -285,7 +285,7 @@ public class JDOMUtil { } @NotNull - public static Document loadDocument(@NotNull Reader reader) throws IOException, JDOMException { + private static Document loadDocument(@NotNull Reader reader) throws IOException, JDOMException { try { return getSaxBuilder().build(reader); }