plusplusjiajia commented on code in PR #5223:
URL: https://github.com/apache/paimon/pull/5223#discussion_r1984715400
##########
paimon-core/src/main/java/org/apache/paimon/rest/RESTUtil.java:
##########
@@ -58,4 +63,28 @@ public static Map<String, String> merge(
return builder.build();
}
+
+ public static String encodeString(String toEncode) {
+ Preconditions.checkArgument(toEncode != null, "Invalid string to
encode: null");
+ try {
+ return URLEncoder.encode(toEncode, StandardCharsets.UTF_8.name());
+ } catch (UnsupportedEncodingException e) {
+ throw new UncheckedIOException(
+ String.format(
+ "Failed to URL encode '%s': UTF-8 encoding is not
supported", toEncode),
+ e);
+ }
+ }
+
+ public static String decodeString(String encoded) {
+ Preconditions.checkArgument(encoded != null, "Invalid string to
decode: null");
Review Comment:
I'm not sure, if it is null or empty, return empty string directly is better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]