diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java index 15664c64e..a527d214b 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java @@ -18,7 +18,7 @@ package org.eclipse.tm4e.core.internal.oniguruma; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import org.jcodings.specific.UTF8Encoding; import org.joni.Matcher; @@ -44,12 +44,7 @@ public OnigRegExp(String source) { lastSearchStrUniqueId = null; lastSearchPosition = -1; lastSearchResult = null; - byte[] pattern; - try { - pattern = source.getBytes("utf-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + byte[] pattern = source.getBytes(StandardCharsets.UTF_8); this.regex = new Regex(pattern, 0, pattern.length, Option.CAPTURE_GROUP, UTF8Encoding.INSTANCE, Syntax.DEFAULT, WarnCallback.DEFAULT); } diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java index 448566144..233a8df53 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java @@ -17,7 +17,7 @@ package org.eclipse.tm4e.core.internal.oniguruma; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; /** * Oniguruma string. @@ -27,15 +27,13 @@ */ public class OnigString { - private static final String UTF_8 = "UTF-8"; - private final String str; private byte[] value; private Object uniqueId; public OnigString(String str) { this.str = str; - this.value = str.getBytes(Charset.forName(UTF_8)); + this.value = str.getBytes(StandardCharsets.UTF_8); this.uniqueId = new Object(); } diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java index fa079df66..4878d65c4 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java @@ -13,6 +13,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import org.eclipse.tm4e.core.internal.parser.PList; @@ -29,7 +30,7 @@ public JSONPListParser(boolean theme) { public T parse(InputStream contents) throws Exception { PList pList = new PList(theme); - JsonReader reader = new JsonReader(new InputStreamReader(contents, Charset.forName("UTF-8"))); + JsonReader reader = new JsonReader(new InputStreamReader(contents, StandardCharsets.UTF_8)); // reader.setLenient(true); boolean parsing = true; while (parsing) {