mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-30 17:12:01 +01:00
Fix nullable issue (#18109)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
7870b15fc3
commit
968cc56452
@ -12,6 +12,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.openhab.binding.nuki.internal;
|
package org.openhab.binding.nuki.internal;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
import org.eclipse.jetty.client.HttpClient;
|
||||||
@ -106,7 +108,7 @@ public class NukiHandlerFactory extends BaseThingHandlerFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable String createCallbackUrl(String id) {
|
private @Nullable String createCallbackUrl(@Nullable String id) {
|
||||||
final String ipAddress = networkAddressService.getPrimaryIpv4HostAddress();
|
final String ipAddress = networkAddressService.getPrimaryIpv4HostAddress();
|
||||||
if (ipAddress == null) {
|
if (ipAddress == null) {
|
||||||
logger.warn("No network interface could be found to get callback address");
|
logger.warn("No network interface could be found to get callback address");
|
||||||
@ -118,7 +120,8 @@ public class NukiHandlerFactory extends BaseThingHandlerFactory {
|
|||||||
logger.warn("Cannot find port of the http service.");
|
logger.warn("Cannot find port of the http service.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String callbackUrl = NukiLinkBuilder.callbackUri(ipAddress, port, id).toString();
|
String callbackUrl = NukiLinkBuilder
|
||||||
|
.callbackUri(ipAddress, port, id != null ? id : UUID.randomUUID().toString()).toString();
|
||||||
logger.trace("callbackUrl[{}]", callbackUrl);
|
logger.trace("callbackUrl[{}]", callbackUrl);
|
||||||
return callbackUrl;
|
return callbackUrl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user