Skip to content

Commit

Permalink
Fix nullable issue (#18109)
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Kreuzer <[email protected]>
  • Loading branch information
kaikreuzer authored Jan 15, 2025
1 parent 7870b15 commit 968cc56
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 968cc56

Please sign in to comment.