Fix Java and Jetty deprecations (#10349)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-03-19 10:40:14 +01:00
committed by GitHub
parent 580f293766
commit fe0c35d22f
43 changed files with 98 additions and 80 deletions

View File

@@ -65,7 +65,7 @@ public class AutelisDiscoveryParticipant implements UpnpDiscoveryParticipant {
properties.put("host", url.getHost());
properties.put("user", "admin");
properties.put("password", "admin");
properties.put("port", new Integer(port));
properties.put("port", Integer.valueOf(port));
DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties).withLabel(label)
.build();

View File

@@ -13,6 +13,8 @@
package org.openhab.binding.autelis.internal.handler;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -30,8 +32,6 @@ import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.util.B64Code;
import org.eclipse.jetty.util.StringUtil;
import org.openhab.binding.autelis.internal.AutelisBindingConstants;
import org.openhab.binding.autelis.internal.config.AutelisConfiguration;
import org.openhab.core.library.types.DecimalType;
@@ -313,7 +313,8 @@ public class AutelisHandler extends BaseThingHandler {
}
baseURL = "http://" + host + ":" + port;
basicAuthentication = "Basic " + B64Code.encode(username + ":" + password, StringUtil.__ISO_8859_1);
basicAuthentication = "Basic "
+ Base64.getEncoder().encodeToString((username + ":" + password).getBytes(StandardCharsets.ISO_8859_1));
logger.debug("Autelius binding configured with base url {} and refresh period of {}", baseURL, refresh);
initPolling(0);