From 10d7fef5d6c4bc02c19f15b92ab8a506899f070f Mon Sep 17 00:00:00 2001 From: sebthom Date: Tue, 14 Nov 2023 19:07:10 +0100 Subject: [PATCH] refact: replace org.snakeyaml 2.2 with org.snakeyaml.engine 2.7 --- org.eclipse.tm4e.core/META-INF/MANIFEST.MF | 2 +- .../tm4e/core/internal/parser/PListParserYAML.java | 10 ++++++---- org.eclipse.tm4e.repository/category.xml | 2 +- target-platform/tm4e-target.target | 6 +++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/org.eclipse.tm4e.core/META-INF/MANIFEST.MF b/org.eclipse.tm4e.core/META-INF/MANIFEST.MF index 51ae0e412..813709168 100644 --- a/org.eclipse.tm4e.core/META-INF/MANIFEST.MF +++ b/org.eclipse.tm4e.core/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: com.google.gson;bundle-version="[2.10.1,3.0.0)", org.apache.batik.util;bundle-version="[1.16.0,2.0.0)";resolution:=optional, org.jcodings;bundle-version="[1.0.58,2.0.0)", org.joni;bundle-version="[2.2.1,3.0.0)", - org.yaml.snakeyaml;bundle-version="[2.2.0,3.0.0)" + org.snakeyaml.engine;bundle-version="[2.7.0,3.0.0)" Import-Package: org.w3c.css.sac;resolution:=optional, org.w3c.css.sac.helpers;resolution:=optional, org.w3c.dom.css diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/PListParserYAML.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/PListParserYAML.java index 2763eb042..2c115b973 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/PListParserYAML.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/PListParserYAML.java @@ -19,9 +19,9 @@ import java.util.Map; import java.util.Map.Entry; +import org.snakeyaml.engine.v2.api.Load; +import org.snakeyaml.engine.v2.api.LoadSettings; import org.xml.sax.SAXException; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.error.YAMLException; /** * Parses TextMate Grammar file in YAML format. @@ -77,11 +77,13 @@ private void addStringToPList(final PListContentHandler pList, final String v pList.endElement(null, "string", null); } + @SuppressWarnings("unchecked") @Override - public T parse(final Reader contents) throws SAXException, YAMLException { + public T parse(final Reader contents) throws SAXException { + final var yamlLoader = new Load(LoadSettings.builder().build()); final var pList = new PListContentHandler(objectFactory); pList.startElement(null, "plist", null, null); - addMapToPList(pList, new Yaml().loadAs(contents, Map.class)); + addMapToPList(pList, (Map) yamlLoader.loadFromReader(contents)); pList.endElement(null, "plist", null); return pList.getResult(); } diff --git a/org.eclipse.tm4e.repository/category.xml b/org.eclipse.tm4e.repository/category.xml index 11ba67188..4b1ce9047 100644 --- a/org.eclipse.tm4e.repository/category.xml +++ b/org.eclipse.tm4e.repository/category.xml @@ -33,7 +33,7 @@ - + diff --git a/target-platform/tm4e-target.target b/target-platform/tm4e-target.target index 56b76dcc1..a45ab969a 100644 --- a/target-platform/tm4e-target.target +++ b/target-platform/tm4e-target.target @@ -26,9 +26,9 @@ - org.yaml - snakeyaml - 2.2 + org.snakeyaml + snakeyaml-engine + 2.7 jar