use our Stack instead of JDK

This commit is contained in:
Vladimir Krivosheev
2018-08-23 09:32:31 +02:00
parent a7d53dd42b
commit 1fae787132
@@ -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<Content> doResolve(@NotNull Element original, String base) throws XIncludeException {
Stack<String> bases = new Stack<String>();
if (base != null) bases.push(base);
if (base != null) {
bases.push(base);
}
List<Content> 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<Content> extractNeededChildren(final Element element, List<Content> remoteElements) {