Avoid UnsupportedEncodingException & use const from StandardCharsets (#11948)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp
2022-01-03 16:05:08 +01:00
committed by GitHub
parent 3f54327d5a
commit 167f8ebc49
52 changed files with 180 additions and 414 deletions

View File

@@ -14,7 +14,6 @@ package org.openhab.binding.shelly.internal.util;
import static org.openhab.binding.shelly.internal.ShellyBindingConstants.*;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
@@ -271,11 +270,7 @@ public class ShellyUtils {
}
public static String urlEncode(String input) {
try {
return URLEncoder.encode(input, StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e) {
return input;
}
return URLEncoder.encode(input, StandardCharsets.UTF_8);
}
public static Long now() {