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

[tellstick] Add null annotations #17974

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lsiepel
Copy link
Contributor

@lsiepel lsiepel commented Dec 24, 2024

  • Add null annotations
  • Fixed most warnings as a result of adding null annotations.

@lsiepel lsiepel requested a review from a team as a code owner December 24, 2024 20:09
Copy link
Contributor

@jlaur jlaur left a 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the default:

should be added here as well?

Suggested change
public long refreshInterval;
public long refreshInterval = 60000;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

if (strValue != null) {
value = Double.valueOf(strValue);
if (dev instanceof TellstickDevice device) {
String strValue = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this assignment necessary?

Copy link
Contributor Author

@lsiepel lsiepel Dec 28, 2024

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

Copy link
Contributor

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);
}

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now.

lsiepel and others added 5 commits December 28, 2024 14:57
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants