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

@@ -13,7 +13,6 @@
package org.openhab.binding.groheondus.internal;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
@@ -55,8 +54,8 @@ public class AccountServlet extends HttpServlet {
}
}
private String servletUrl() throws UnsupportedEncodingException {
return "/groheondus/" + URLEncoder.encode(bridgeId, StandardCharsets.UTF_8.name());
private String servletUrl() {
return "/groheondus/" + URLEncoder.encode(bridgeId, StandardCharsets.UTF_8);
}
@Override
@@ -130,10 +129,6 @@ public class AccountServlet extends HttpServlet {
}
public void dispose() {
try {
httpService.unregister(servletUrl());
} catch (UnsupportedEncodingException e) {
logger.warn("Unregistration of servlet failed", e);
}
httpService.unregister(servletUrl());
}
}