Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nuki] Fix nullable issue #18109

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package org.openhab.binding.nuki.internal;

import java.util.UUID;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
Expand Down Expand Up @@ -106,7 +108,7 @@ public void unregisterHandler(Thing thing) {
}
}

private @Nullable String createCallbackUrl(String id) {
private @Nullable String createCallbackUrl(@Nullable String id) {
final String ipAddress = networkAddressService.getPrimaryIpv4HostAddress();
if (ipAddress == null) {
logger.warn("No network interface could be found to get callback address");
Expand All @@ -118,7 +120,8 @@ public void unregisterHandler(Thing thing) {
logger.warn("Cannot find port of the http service.");
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);
return callbackUrl;
}
Expand Down