Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java119
-rw-r--r--org.eclipse.debug.core/pom.xml4
-rw-r--r--org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css3
-rw-r--r--org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css3
5 files changed, 87 insertions, 44 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 930cbe6ec..ccb2fa5e6 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.13.0.qualifier
+Bundle-Version: 3.13.50.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java
index d149c0f4b..7372a9b4d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -19,6 +19,7 @@ import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
+import java.util.Arrays;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -43,6 +44,8 @@ public final class XMLMemento {
private Element element;
+ private static String FILE_STRING = "file"; //$NON-NLS-1$
+
/**
* Creates a <code>Document</code> from the <code>Reader</code>
* and returns a memento on the first <code>Element</code> for reading
@@ -60,51 +63,89 @@ public final class XMLMemento {
return createReadRoot(reader, null);
}
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @param baseDir the directory used to resolve relative file names
- * in the XML document. This directory must exist and include the
- * trailing separator. The directory format, including the separators,
- * must be valid for the platform. Can be <code>null</code> if not
- * needed.
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws Exception if IO problems, invalid format, or no element.
- */
+ /**
+ * Clients who need to use the "file" protocol can override this method to
+ * return the original attribute value
+ *
+ * @param attributeOldValue
+ * @return return the new attribute value after concatenating the "file"
+ * protocol restriction if does not exist already
+ */
+ private static String getAttributeNewValue(Object attributeOldValue) {
+ StringBuffer strNewValue = new StringBuffer(FILE_STRING);
+ if (attributeOldValue instanceof String && ((String) attributeOldValue).length() != 0) {
+ String strOldValue = (String) attributeOldValue;
+ boolean exists = Arrays.asList(strOldValue.split(",")).stream().anyMatch(x -> x.trim().equals(FILE_STRING)); //$NON-NLS-1$
+ if (!exists) {
+ strNewValue.append(", ").append(strOldValue); //$NON-NLS-1$
+ } else {
+ strNewValue = new StringBuffer(strOldValue);
+ }
+ }
+ return strNewValue.toString();
+ }
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code> and returns
+ * a memento on the first <code>Element</code> for reading the document.
+ *
+ * @param reader the <code>Reader</code> used to create the memento's
+ * document
+ * @param baseDir the directory used to resolve relative file names in the
+ * XML document. This directory must exist and include the
+ * trailing separator. The directory format, including the
+ * separators, must be valid for the platform. Can be
+ * <code>null</code> if not needed.
+ * @return a memento on the first <code>Element</code> for reading the
+ * document
+ * @throws Exception if IO problems, invalid format, or no element.
+ */
public static XMLMemento createReadRoot(Reader reader, String baseDir)
throws Exception {
- String errorMessage = null;
- Exception exception = null;
+ String errorMessage = null;
+ Exception exception = null;
+ DocumentBuilderFactory factory = null;
+ Object attributeDTDOldValue = null;
+ Object attributeSchemaOldValue = null;
+ try {
+ factory = DocumentBuilderFactory.newInstance();
+ try {
+ attributeDTDOldValue = factory.getAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD);
+ attributeSchemaOldValue = factory.getAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA);
+ } catch (NullPointerException | IllegalArgumentException e) {
+ // Attributes not defined
+ }
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, getAttributeNewValue(attributeDTDOldValue));
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA, getAttributeNewValue(attributeSchemaOldValue));
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory
- .newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- InputSource source = new InputSource(reader);
- if (baseDir != null) {
+ DocumentBuilder parser = factory.newDocumentBuilder();
+ InputSource source = new InputSource(reader);
+ if (baseDir != null) {
source.setSystemId(baseDir);
}
- Document document = parser.parse(source);
- NodeList list = document.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (node instanceof Element) {
+ Document document = parser.parse(source);
+ NodeList list = document.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ if (node instanceof Element) {
return new XMLMemento(document, (Element) node);
}
- }
- } catch (ParserConfigurationException e) {
- exception = e;
- // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError;
- } catch (IOException e) {
- exception = e;
- // errorMessage = WorkbenchMessages.XMLMemento_ioError;
- } catch (SAXException e) {
- exception = e;
- // errorMessage = WorkbenchMessages.XMLMemento_formatError;
- }
+ }
+ } catch (ParserConfigurationException e) {
+ exception = e;
+ // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError;
+ } catch (IOException e) {
+ exception = e;
+ // errorMessage = WorkbenchMessages.XMLMemento_ioError;
+ } catch (SAXException e) {
+ exception = e;
+ // errorMessage = WorkbenchMessages.XMLMemento_formatError;
+ } finally {
+ if (factory != null) {
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, attributeDTDOldValue);
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA, attributeSchemaOldValue);
+ }
+ }
String problemText = null;
if (exception != null) {
diff --git a/org.eclipse.debug.core/pom.xml b/org.eclipse.debug.core/pom.xml
index 52228e425..0ce765eff 100644
--- a/org.eclipse.debug.core/pom.xml
+++ b/org.eclipse.debug.core/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2018 Eclipse Foundation and others.
+ Copyright (c) 2012, 2021 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -18,6 +18,6 @@
</parent>
<groupId>org.eclipse.debug</groupId>
<artifactId>org.eclipse.debug.core</artifactId>
- <version>3.13.0-SNAPSHOT</version>
+ <version>3.13.50-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css
index da1f40fa5..248b776f1 100644
--- a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css
+++ b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css
@@ -26,7 +26,8 @@ IEclipsePreferences#org-eclipse-debug-ui {
'org.eclipse.debug.ui.outColor=235,235,235'
}
-#DebugBreadcrumbComposite,
+#DebugBreadcrumbComposite
+#DebugBreadcrumbComposite > Composite,
#DebugBreadcrumbItemComposite,
#DebugBreadcrumbItemDetailComposite,
#DebugBreadcrumbItemDetailTextComposite,
diff --git a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css
index a0a402885..b0df8dd4f 100644
--- a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css
+++ b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css
@@ -9,7 +9,8 @@
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-#DebugBreadcrumbComposite,
+#DebugBreadcrumbComposite
+#DebugBreadcrumbComposite > Composite,
#DebugBreadcrumbItemComposite,
#DebugBreadcrumbItemDetailComposite,
#DebugBreadcrumbItemDetailTextComposite,

Back to the top