Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions util/src/main/java/io/kubernetes/client/Exec.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -437,11 +438,7 @@ public ExecutionBuilder setOnUnhandledError(Consumer<Throwable> onUnhandledError
private String makePath() {
String[] encodedCommand = new String[command.length];
for (int i = 0; i < command.length; i++) {
try {
encodedCommand[i] = URLEncoder.encode(command[i], "UTF-8");
} catch (UnsupportedEncodingException ex) {
throw new RuntimeException("some thing wrong happend: " + ex.getMessage());
}
encodedCommand[i] = URLEncoder.encode(command[i], StandardCharsets.UTF_8);
}
return "/api/v1/namespaces/"
+ namespace
Expand Down Expand Up @@ -614,7 +611,7 @@ public OutputStream getResizeStream() {
public void resize(int width, int height) throws IOException {
OutputStream resizeStream = getResizeStream();
String resize = "{ \"width\": " + width + ", \"height\": " + height + " }\n";
resizeStream.write(resize.getBytes("UTF-8"));
resizeStream.write(resize.getBytes(StandardCharsets.UTF_8));
resizeStream.flush();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Enumeration;
Expand Down Expand Up @@ -491,7 +492,7 @@ private static List<String> getClassNamesFromPackage(ClassLoader classLoader, St
}

private static void processJarPackage(URL packageURL, String packageName, String pkg, ArrayList<String> names) throws IOException {
String jarFileName = URLDecoder.decode(packageURL.getFile(), "UTF-8");
String jarFileName = URLDecoder.decode(packageURL.getFile(), StandardCharsets.UTF_8);
JarFile jf = null;
// jar: client in repository; nested: client in a fat jar
if (jarFileName.startsWith("jar:") || jarFileName.startsWith("nested:")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private JSONObject refreshOidcToken(
String urlData =
new StringBuilder()
.append("refresh_token=")
.append(URLEncoder.encode(refreshToken, "UTF-8"))
.append(URLEncoder.encode(refreshToken, StandardCharsets.UTF_8))
.append("&grant_type=refresh_token")
.toString();
OutputStream ou = https.getOutputStream();
Expand Down
2 changes: 1 addition & 1 deletion util/src/test/java/io/kubernetes/client/ExecTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void terminalResize() throws IOException, InterruptedException {
process.resize(100, 100);
process.destroy();

String out = bos.toString("UTF-8");
String out = bos.toString(StandardCharsets.UTF_8);
assertThat(out).isEqualTo("{ \"width\": 100, \"height\": 100 }\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import okhttp3.Request;
import okhttp3.WebSocket;
import okio.ByteString;
Expand Down Expand Up @@ -68,7 +69,7 @@ void handlerSendingData() throws IOException {

OutputStream outputStream = handler.getOutputStream(testStreamId);

byte[] bytes = "This is a test string".getBytes("UTF-8");
byte[] bytes = "This is a test string".getBytes(StandardCharsets.UTF_8);
byte[] output = new byte[bytes.length + 1];
output[0] = 0;
for (int i = 0; i < bytes.length; i++) {
Expand Down
Loading