Avoid UnsupportedEncodingException & use const from StandardCharsets (#11948)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
committed by
GitHub
parent
3f54327d5a
commit
167f8ebc49
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user