Skip to content

Commit 2b1eac3

Browse files
committed
Pass Charset directly
1 parent e0a5504 commit 2b1eac3

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueIdFormat.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import java.io.Serial;
1717
import java.io.Serializable;
18-
import java.io.UnsupportedEncodingException;
1918
import java.net.URLDecoder;
2019
import java.net.URLEncoder;
2120
import java.nio.charset.StandardCharsets;
@@ -51,12 +50,7 @@ private static String quote(char c) {
5150
}
5251

5352
private static String encode(char c) {
54-
try {
55-
return URLEncoder.encode(String.valueOf(c), StandardCharsets.UTF_8.name());
56-
}
57-
catch (UnsupportedEncodingException e) {
58-
throw new AssertionError("UTF-8 should be supported", e);
59-
}
53+
return URLEncoder.encode(String.valueOf(c), StandardCharsets.UTF_8);
6054
}
6155

6256
private final char openSegment;
@@ -152,12 +146,7 @@ private String encode(String s) {
152146
}
153147

154148
private static String decode(String s) {
155-
try {
156-
return URLDecoder.decode(s, StandardCharsets.UTF_8.name());
157-
}
158-
catch (UnsupportedEncodingException e) {
159-
throw new JUnitException("UTF-8 should be supported", e);
160-
}
149+
return URLDecoder.decode(s, StandardCharsets.UTF_8);
161150
}
162151

163152
}

0 commit comments

Comments
 (0)