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
@@ -16,7 +16,6 @@ import java.beans.Introspector;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -172,22 +171,17 @@ public class DenonMarantzHttpConnector extends DenonMarantzConnector {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String url = cmdUrl + URLEncoder.encode(command, Charset.defaultCharset().displayName());
|
||||
logger.trace("Calling url {}", url);
|
||||
String url = cmdUrl + URLEncoder.encode(command, Charset.defaultCharset());
|
||||
logger.trace("Calling url {}", url);
|
||||
|
||||
httpClient.newRequest(url).timeout(5, TimeUnit.SECONDS).send(new Response.CompleteListener() {
|
||||
@Override
|
||||
public void onComplete(Result result) {
|
||||
if (result.getResponse().getStatus() != 200) {
|
||||
logger.warn("Error {} while sending command", result.getResponse().getReason());
|
||||
}
|
||||
httpClient.newRequest(url).timeout(5, TimeUnit.SECONDS).send(new Response.CompleteListener() {
|
||||
@Override
|
||||
public void onComplete(Result result) {
|
||||
if (result.getResponse().getStatus() != 200) {
|
||||
logger.warn("Error {} while sending command", result.getResponse().getReason());
|
||||
}
|
||||
});
|
||||
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.warn("Error sending command", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateMain() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user