Skip to content

Commit

Permalink
SEBSP-163 applied to patch
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Sep 18, 2024
1 parent 81ced3a commit eba5a0c
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/main/java/ch/ethz/seb/sps/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,29 +401,15 @@ public static String encodeFormURL_UTF_8(final String value) {
return value;
}

try {
return URLEncoder.encode(value, StandardCharsets.UTF_8.name());
} catch (final UnsupportedEncodingException e) {
log.error("Failed to encode FormURL_UTF_8 for: {}", value, e);
return value;
}
return URLEncoder.encode(value, StandardCharsets.UTF_8);
}

public static String decodeFormURL_UTF_8(final String value) {
if (StringUtils.isBlank(value)) {
return value;
}

try {
return URLDecoder.decode(
(value.indexOf('+') >= 0)
? value.replaceAll("\\+", "%2b")
: value,
StandardCharsets.UTF_8.name());
} catch (final UnsupportedEncodingException e) {
log.error("Failed to decode FormURL_UTF_8 for: {}", value, e);
return value;
}
return URLDecoder.decode(value, StandardCharsets.UTF_8);
}

public static void clearCharArray(final char[] array) {
Expand Down

0 comments on commit eba5a0c

Please sign in to comment.