Use StandardCharsets

This commit is contained in:
Josh Soref committed 2019-02-20 18:54:18 -05:00
1 parent a43efeab66
commit c0815b50de
20 files changed
+51 -56

No files matched your search

+3 -2
View File
@@ -25,6 +25,7 @@ package hudson;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import jenkins.util.SystemProperties;
@@ -97,7 +98,7 @@ public class Main {
// check for authentication info
String auth = new URL(home).getUserInfo();
if(auth != null) auth = "Basic " + new Base64Encoder().encode(auth.getBytes("UTF-8"));
if(auth != null) auth = "Basic " + new Base64Encoder().encode(auth.getBytes(StandardCharsets.UTF_8));
{// check if the home is set correctly
HttpURLConnection con = open(new URL(home));
@@ -143,7 +144,7 @@ public class Main {
try {
int ret;
try (OutputStream os = Files.newOutputStream(tmpFile.toPath());
Writer w = new OutputStreamWriter(os,"UTF-8")) {
Writer w = new OutputStreamWriter(os, StandardCharsets.UTF_8)) {
w.write("<?xml version='1.1' encoding='UTF-8'?>");
w.write("<run><log encoding='hexBinary' content-encoding='"+Charset.defaultCharset().name()+"'>");
w.flush();