From 1fae7871323e6048a834d0bd1d3ae3cd171b738b Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 22 Aug 2018 16:20:07 +0200 Subject: [PATCH] use our Stack instead of JDK --- .../com/intellij/util/xmlb/JDOMXIncluder.java | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/platform/util/src/com/intellij/util/xmlb/JDOMXIncluder.java b/platform/util/src/com/intellij/util/xmlb/JDOMXIncluder.java index 943f34e129d0..50210b0d7724 100644 --- a/platform/util/src/com/intellij/util/xmlb/JDOMXIncluder.java +++ b/platform/util/src/com/intellij/util/xmlb/JDOMXIncluder.java @@ -1,24 +1,11 @@ -/* - * Copyright 2000-2013 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.util.xmlb; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.StreamUtil; +import com.intellij.util.containers.Stack; import com.intellij.util.io.URLUtil; import org.jdom.*; import org.jetbrains.annotations.NonNls; @@ -28,7 +15,10 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -170,14 +160,16 @@ public class JDOMXIncluder { return result; } + @NotNull private List doResolve(@NotNull Element original, String base) throws XIncludeException { Stack bases = new Stack(); - if (base != null) bases.push(base); + if (base != null) { + bases.push(base); + } List result = resolve(original, bases); bases.pop(); return result; - } private static boolean isIncludeElement(Element element) { @@ -267,14 +259,13 @@ public class JDOMXIncluder { throw new XIncludeException(e); } } - } //xpointer($1) - @NonNls public static Pattern XPOINTER_PATTERN = Pattern.compile("xpointer\\((.*)\\)"); + @NonNls public static final Pattern XPOINTER_PATTERN = Pattern.compile("xpointer\\((.*)\\)"); // /$1(/$2)?/* - public static Pattern CHILDREN_PATTERN = Pattern.compile("/([^/]*)(/[^/]*)?/\\*"); + public static final Pattern CHILDREN_PATTERN = Pattern.compile("/([^/]*)(/[^/]*)?/\\*"); @Nullable private static List extractNeededChildren(final Element element, List remoteElements) {