Use StandardCharsets 28/92528/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Sep 2020 10:52:12 +0000 (12:52 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 21 Sep 2020 11:00:46 +0000 (11:00 +0000)
Java 10 allows us to use a proper constant for charset.

Change-Id: Ie7706356bf5bcbde05e7632b099901d226f40cf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/Bug5410Test.java
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6878Test.java
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5335Test.java
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/SubstatementValidatorTest.java
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java

index 08aa0513adab69fb2b715bf94473fd25b22f7567..50f27f9f6107418105fdc6e31b2c0d9eb94a062a 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableList;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import org.junit.Test;
 
@@ -150,7 +151,7 @@ public class Bug5410Test {
             throws UnsupportedEncodingException {
         final PrintStream stdout = System.out;
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
-        System.setOut(new PrintStream(output, true, "UTF-8"));
+        System.setOut(new PrintStream(output, true, StandardCharsets.UTF_8));
 
         RegexUtils.getJavaRegexFromXSD(xsdRegex);
 
index 5b7875fe0ab4ca192151f6f15165b610d6c9896e..b6201bca7b9f28d7694b2f0bddedc4b7c160a735 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertFalse;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
 
@@ -41,7 +42,7 @@ public class Bug6878Test {
         final PrintStream stdout = System.out;
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
 
-        try (PrintStream out = new PrintStream(output, true, "UTF-8")) {
+        try (PrintStream out = new PrintStream(output, true, StandardCharsets.UTF_8)) {
             System.setOut(out);
             StmtTestUtils.parseYangSource(yangFile);
         } finally {
index e325c0c0ac46d6f9cf505cc566df3a376a68e5bc..ac9912c4cc537af7e813f9f70fe5d2edd3f08563 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
@@ -15,6 +14,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -42,7 +42,7 @@ public class Bug5335Test {
 
     @Before
     public void setUp() throws UnsupportedEncodingException {
-        System.setOut(new PrintStream(output, true, "UTF-8"));
+        System.setOut(new PrintStream(output, true, StandardCharsets.UTF_8));
     }
 
     @After
index d2baf198e76924f285bf438f931f890e6a06ba1e..be3cc46eaea1471ce95f0160069f530f0d714ff2 100644 (file)
@@ -16,6 +16,7 @@ import static org.junit.Assert.fail;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Collection;
 import org.junit.After;
 import org.junit.Before;
@@ -31,7 +32,7 @@ public class SubstatementValidatorTest {
 
     @Before
     public void setUp() throws UnsupportedEncodingException {
-        System.setOut(new PrintStream(output, true, "UTF-8"));
+        System.setOut(new PrintStream(output, true, StandardCharsets.UTF_8));
     }
 
     @After
index 1d17d1f01f0bacc9e02358da929507459d1e8aad..c6160eed4f2735ef1e5c5185feb05b320415e495 100644 (file)
@@ -18,6 +18,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,7 +37,7 @@ public class YangParserNegativeTest {
 
     @Before
     public void setUp() throws UnsupportedEncodingException {
-        System.setOut(new PrintStream(output, true, "UTF-8"));
+        System.setOut(new PrintStream(output, true, StandardCharsets.UTF_8));
     }
 
     @After