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

@@ -15,7 +15,6 @@ package org.openhab.binding.freebox.internal.api;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
@@ -470,11 +469,7 @@ public class FreeboxApiManager {
}
private String encodeUrl(String url) throws FreeboxException {
try {
return URLEncoder.encode(url, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new FreeboxException("Encoding the URL \"" + url + "\" in UTF-8 failed", e);
}
return URLEncoder.encode(url, StandardCharsets.UTF_8);
}
public static String hmacSha1(String key, String value) throws FreeboxException {