Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix test_prrecorder::test_make_full_record #794

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions experimentation/tools/tests/resources/prs_final.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
"parseTimeMs": 2886
},
"diffs": {
"initial": "diff --git a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\nindex 26e318d6..e8f3d908 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n@@ -7,6 +7,7 @@\n * Contributors: Red Hat, Inc.\n ******************************************************************************/\n package org.jboss.tools.rsp.internal.launching.java.util;\n+import javax.xml.XMLConstants;\n \n import java.io.ByteArrayInputStream;\n import java.io.File;\n@@ -82,7 +83,7 @@\n \tprivate static DocumentBuilder getParser() throws CoreException {\n \t\tif (fgXMLParser == null) {\n \t\t\ttry {\n-\t\t\t\tfgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();\n+\t\t\t\tfgXMLParser = createDocumentBuilderFactory().newDocumentBuilder();\n \t\t\t\tfgXMLParser.setErrorHandler(new DefaultHandler());\n \t\t\t} catch (ParserConfigurationException e) {\n \t\t\t\tabort(LaunchingPlugin_34, e);\n@@ -348,4 +349,11 @@ protected static void abort(String message, Throwable exception, int code) throw\n \t\tthrow new CoreException(new Status(IStatus.ERROR, IVMInstallChangedListener.LAUNCHING_ID_PLUGIN,\n \t\t\t\tcode, message, exception));\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n }\ndiff --git a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\nindex 291d3814..92e60d19 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n@@ -89,7 +89,7 @@ public static XMLMemento createReadRoot(InputStream in) {\n \t\t\n \t\tDocument document = null;\n \t\ttry {\t\n-\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\t\tDocumentBuilderFactory factory = createDocumentBuilderFactory();\n \t\t\tDocumentBuilder parser = factory.newDocumentBuilder();\n \t\t\tdocument = parser.parse(new InputSource(in));\n \t\t\tNode node = document.getFirstChild();\n@@ -126,7 +126,7 @@ private static void logError(Exception t) {\n \tpublic static XMLMemento createWriteRoot(String type) {\n \t\tDocument document;\n \t\ttry {\n-\t\t\tdocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();\n+\t\t\tdocument = createDocumentBuilderFactory().newDocumentBuilder().newDocument();\n \t\t\tElement element = document.createElement(type);\n \t\t\tdocument.appendChild(element);\n \t\t\treturn new XMLMemento(document, element);\n@@ -348,7 +348,7 @@ public void save(OutputStream os) throws IOException {\n \t\tResult result = new StreamResult(os);\n \t\tSource source = new DOMSource(factory);\n \t\ttry {\n-\t\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\t\tTransformerFactory factory = createTransformerFactory();\n \t\t\tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);\n \t\t\tTransformer transformer = factory.newTransformer();\n \t\t\ttransformer.setOutputProperty(OutputKeys.INDENT, \"yes\"); //$NON-NLS-1$\n@@ -436,4 +436,18 @@ public String getTextData() {\n \t\t}\n \t\treturn \"\"; //$NON-NLS-1$\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n+\n+\tprivate static TransformerFactory createTransformerFactory() {\n+\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, \"\");\n+\t\treturn factory;\n+\t}\n }\n\\ No newline at end of file\n",
"final": "diff --git a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\nindex 26e318d6..e8f3d908 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n@@ -7,6 +7,7 @@\n * Contributors: Red Hat, Inc.\n ******************************************************************************/\n package org.jboss.tools.rsp.internal.launching.java.util;\n+import javax.xml.XMLConstants;\n \n import java.io.ByteArrayInputStream;\n import java.io.File;\n@@ -82,7 +83,7 @@\n \tprivate static DocumentBuilder getParser() throws CoreException {\n \t\tif (fgXMLParser == null) {\n \t\t\ttry {\n-\t\t\t\tfgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();\n+\t\t\t\tfgXMLParser = createDocumentBuilderFactory().newDocumentBuilder();\n \t\t\t\tfgXMLParser.setErrorHandler(new DefaultHandler());\n \t\t\t} catch (ParserConfigurationException e) {\n \t\t\t\tabort(LaunchingPlugin_34, e);\n@@ -348,4 +349,11 @@ protected static void abort(String message, Throwable exception, int code) throw\n \t\tthrow new CoreException(new Status(IStatus.ERROR, IVMInstallChangedListener.LAUNCHING_ID_PLUGIN,\n \t\t\t\tcode, message, exception));\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n }\ndiff --git a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\nindex 291d3814..92e60d19 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n@@ -89,7 +89,7 @@ public static XMLMemento createReadRoot(InputStream in) {\n \t\t\n \t\tDocument document = null;\n \t\ttry {\t\n-\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\t\tDocumentBuilderFactory factory = createDocumentBuilderFactory();\n \t\t\tDocumentBuilder parser = factory.newDocumentBuilder();\n \t\t\tdocument = parser.parse(new InputSource(in));\n \t\t\tNode node = document.getFirstChild();\n@@ -126,7 +126,7 @@ private static void logError(Exception t) {\n \tpublic static XMLMemento createWriteRoot(String type) {\n \t\tDocument document;\n \t\ttry {\n-\t\t\tdocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();\n+\t\t\tdocument = createDocumentBuilderFactory().newDocumentBuilder().newDocument();\n \t\t\tElement element = document.createElement(type);\n \t\t\tdocument.appendChild(element);\n \t\t\treturn new XMLMemento(document, element);\n@@ -348,7 +348,7 @@ public void save(OutputStream os) throws IOException {\n \t\tResult result = new StreamResult(os);\n \t\tSource source = new DOMSource(factory);\n \t\ttry {\n-\t\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\t\tTransformerFactory factory = createTransformerFactory();\n \t\t\tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);\n \t\t\tTransformer transformer = factory.newTransformer();\n \t\t\ttransformer.setOutputProperty(OutputKeys.INDENT, \"yes\"); //$NON-NLS-1$\n@@ -436,4 +436,18 @@ public String getTextData() {\n \t\t}\n \t\treturn \"\"; //$NON-NLS-1$\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n+\n+\tprivate static TransformerFactory createTransformerFactory() {\n+\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, \"\");\n+\t\treturn factory;\n+\t}\n }\n\\ No newline at end of file\n"
"initial": "diff --git a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\nindex 26e318d6..e8f3d908 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n@@ -7,6 +7,7 @@\n * Contributors: Red Hat, Inc.\n ******************************************************************************/\n package org.jboss.tools.rsp.internal.launching.java.util;\n+import javax.xml.XMLConstants;\n \n import java.io.ByteArrayInputStream;\n import java.io.File;\n@@ -82,7 +83,7 @@ public class LaunchingSupportUtils {\n \tprivate static DocumentBuilder getParser() throws CoreException {\n \t\tif (fgXMLParser == null) {\n \t\t\ttry {\n-\t\t\t\tfgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();\n+\t\t\t\tfgXMLParser = createDocumentBuilderFactory().newDocumentBuilder();\n \t\t\t\tfgXMLParser.setErrorHandler(new DefaultHandler());\n \t\t\t} catch (ParserConfigurationException e) {\n \t\t\t\tabort(LaunchingPlugin_34, e);\n@@ -348,4 +349,11 @@ protected static void abort(String message, Throwable exception, int code) throw\n \t\tthrow new CoreException(new Status(IStatus.ERROR, IVMInstallChangedListener.LAUNCHING_ID_PLUGIN,\n \t\t\t\tcode, message, exception));\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n }\ndiff --git a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\nindex 291d3814..92e60d19 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n@@ -89,7 +89,7 @@ public static XMLMemento createReadRoot(InputStream in) {\n \t\t\n \t\tDocument document = null;\n \t\ttry {\t\n-\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\t\tDocumentBuilderFactory factory = createDocumentBuilderFactory();\n \t\t\tDocumentBuilder parser = factory.newDocumentBuilder();\n \t\t\tdocument = parser.parse(new InputSource(in));\n \t\t\tNode node = document.getFirstChild();\n@@ -126,7 +126,7 @@ private static void logError(Exception t) {\n \tpublic static XMLMemento createWriteRoot(String type) {\n \t\tDocument document;\n \t\ttry {\n-\t\t\tdocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();\n+\t\t\tdocument = createDocumentBuilderFactory().newDocumentBuilder().newDocument();\n \t\t\tElement element = document.createElement(type);\n \t\t\tdocument.appendChild(element);\n \t\t\treturn new XMLMemento(document, element);\n@@ -348,7 +348,7 @@ public void save(OutputStream os) throws IOException {\n \t\tResult result = new StreamResult(os);\n \t\tSource source = new DOMSource(factory);\n \t\ttry {\n-\t\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\t\tTransformerFactory factory = createTransformerFactory();\n \t\t\tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);\n \t\t\tTransformer transformer = factory.newTransformer();\n \t\t\ttransformer.setOutputProperty(OutputKeys.INDENT, \"yes\"); //$NON-NLS-1$\n@@ -436,4 +436,18 @@ public String getTextData() {\n \t\t}\n \t\treturn \"\"; //$NON-NLS-1$\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n+\n+\tprivate static TransformerFactory createTransformerFactory() {\n+\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, \"\");\n+\t\treturn factory;\n+\t}\n }\n\\ No newline at end of file\n",
"final": "diff --git a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\nindex 26e318d6..e8f3d908 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching.java/src/main/java/org/jboss/tools/rsp/internal/launching/java/util/LaunchingSupportUtils.java\n@@ -7,6 +7,7 @@\n * Contributors: Red Hat, Inc.\n ******************************************************************************/\n package org.jboss.tools.rsp.internal.launching.java.util;\n+import javax.xml.XMLConstants;\n \n import java.io.ByteArrayInputStream;\n import java.io.File;\n@@ -82,7 +83,7 @@ public class LaunchingSupportUtils {\n \tprivate static DocumentBuilder getParser() throws CoreException {\n \t\tif (fgXMLParser == null) {\n \t\t\ttry {\n-\t\t\t\tfgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();\n+\t\t\t\tfgXMLParser = createDocumentBuilderFactory().newDocumentBuilder();\n \t\t\t\tfgXMLParser.setErrorHandler(new DefaultHandler());\n \t\t\t} catch (ParserConfigurationException e) {\n \t\t\t\tabort(LaunchingPlugin_34, e);\n@@ -348,4 +349,11 @@ protected static void abort(String message, Throwable exception, int code) throw\n \t\tthrow new CoreException(new Status(IStatus.ERROR, IVMInstallChangedListener.LAUNCHING_ID_PLUGIN,\n \t\t\t\tcode, message, exception));\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n }\ndiff --git a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\nindex 291d3814..92e60d19 100644\n--- a/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n+++ b/framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/launching/memento/XMLMemento.java\n@@ -89,7 +89,7 @@ public static XMLMemento createReadRoot(InputStream in) {\n \t\t\n \t\tDocument document = null;\n \t\ttry {\t\n-\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\t\tDocumentBuilderFactory factory = createDocumentBuilderFactory();\n \t\t\tDocumentBuilder parser = factory.newDocumentBuilder();\n \t\t\tdocument = parser.parse(new InputSource(in));\n \t\t\tNode node = document.getFirstChild();\n@@ -126,7 +126,7 @@ private static void logError(Exception t) {\n \tpublic static XMLMemento createWriteRoot(String type) {\n \t\tDocument document;\n \t\ttry {\n-\t\t\tdocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();\n+\t\t\tdocument = createDocumentBuilderFactory().newDocumentBuilder().newDocument();\n \t\t\tElement element = document.createElement(type);\n \t\t\tdocument.appendChild(element);\n \t\t\treturn new XMLMemento(document, element);\n@@ -348,7 +348,7 @@ public void save(OutputStream os) throws IOException {\n \t\tResult result = new StreamResult(os);\n \t\tSource source = new DOMSource(factory);\n \t\ttry {\n-\t\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\t\tTransformerFactory factory = createTransformerFactory();\n \t\t\tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);\n \t\t\tTransformer transformer = factory.newTransformer();\n \t\t\ttransformer.setOutputProperty(OutputKeys.INDENT, \"yes\"); //$NON-NLS-1$\n@@ -436,4 +436,18 @@ public String getTextData() {\n \t\t}\n \t\treturn \"\"; //$NON-NLS-1$\n \t}\n+\n+\tprivate static DocumentBuilderFactory createDocumentBuilderFactory() {\n+\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n+\t\treturn factory;\n+\t}\n+\n+\tprivate static TransformerFactory createTransformerFactory() {\n+\t\tTransformerFactory factory = TransformerFactory.newInstance();\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\n+\t\tfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, \"\");\n+\t\treturn factory;\n+\t}\n }\n\\ No newline at end of file\n"
},
"manualEdits": [],
"recordMetadata": {
Expand Down
Loading