diff --git a/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java b/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java index e7157b5ab..325224b76 100644 --- a/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java +++ b/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java @@ -35,6 +35,8 @@ import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.URL; +import java.nio.charset.StandardCharsets; + import org.apache.commons.io.IOUtils; /** @@ -53,7 +55,7 @@ public SingleFileSCM(String path, byte[] contents) { public SingleFileSCM(String path, String contents) throws UnsupportedEncodingException { this.path = path; - this.contents = contents.getBytes("UTF-8"); + this.contents = contents.getBytes(StandardCharsets.UTF_8); } /** diff --git a/src/main/java/org/jvnet/hudson/test/TestPluginManager.java b/src/main/java/org/jvnet/hudson/test/TestPluginManager.java index 39213ac5b..c9a364669 100644 --- a/src/main/java/org/jvnet/hudson/test/TestPluginManager.java +++ b/src/main/java/org/jvnet/hudson/test/TestPluginManager.java @@ -36,6 +36,7 @@ import java.lang.reflect.Method; import java.net.URISyntaxException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -113,7 +114,7 @@ private Set loadBundledPlugins(File fromDir) throws IOException, URISynt // and copy them into $JENKINS_HOME/plugins. URL index = getClass().getResource("/test-dependencies/index"); if (index!=null) {// if built with maven-hpi-plugin < 1.52 this file won't exist. - BufferedReader r = new BufferedReader(new InputStreamReader(index.openStream(),"UTF-8")); + BufferedReader r = new BufferedReader(new InputStreamReader(index.openStream(), StandardCharsets.UTF_8)); try { String line; while ((line=r.readLine())!=null) {