-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[tellstick] Add null annotations #17974
base: main
Are you sure you want to change the base?
Conversation
lsiepel
commented
Dec 24, 2024
- Add null annotations
- Fixed most warnings as a result of adding null annotations.
Signed-off-by: Leo Siepel <[email protected]>
Signed-off-by: Leo Siepel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the annotations and warnings. Can you rebase to make the dependency upgrades disappear? 🙂
public String ipAddress; | ||
public String accessToken; | ||
public String ipAddress = ""; | ||
public String accessToken = ""; | ||
public long refreshInterval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the default:
openhab-addons/bundles/org.openhab.binding.tellstick/src/main/resources/OH-INF/thing/bridge.xml
Line 76 in d14749b
<default>60000</default> |
should be added here as well?
public long refreshInterval; | |
public long refreshInterval = 60000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
...tick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java
Outdated
Show resolved
Hide resolved
...tick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java
Outdated
Show resolved
Hide resolved
if (strValue != null) { | ||
value = Double.valueOf(strValue); | ||
if (dev instanceof TellstickDevice device) { | ||
String strValue = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this assignment necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise I get a warning the var is not initialised
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Maybe a slight refactor will make it more readable?
String strValue = device.getData();
if (strValue != null) {
value = Double.valueOf(strValue);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way better. Wondering why i took that turn... :-)
logger.debug("Current remaining delay {}", pollingJob.getDelay(TimeUnit.SECONDS)); | ||
if (pollingJob.getDelay(TimeUnit.SECONDS) > REFRESH_DELAY) { | ||
ScheduledFuture<?> immediateRefreshJob = this.immediateRefreshJob; | ||
if (immediateRefreshJob == null || immediateRefreshJob.isDone()) { | ||
immediateRefreshJob = scheduler.schedule(this::refreshDeviceList, REFRESH_DELAY, TimeUnit.SECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will start a wild-running thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now.
...k/src/main/java/org/openhab/binding/tellstick/internal/live/TelldusLiveDeviceController.java
Outdated
Show resolved
Hide resolved
…b/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java Co-authored-by: Jacob Laursen <[email protected]> Signed-off-by: lsiepel <[email protected]>
…b/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java Co-authored-by: Jacob Laursen <[email protected]> Signed-off-by: lsiepel <[email protected]>
…b/binding/tellstick/internal/live/TelldusLiveDeviceController.java Co-authored-by: Jacob Laursen <[email protected]> Signed-off-by: lsiepel <[email protected]>
Signed-off-by: Leo Siepel <[email protected]>