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

Value or default bug #635

Merged
merged 14 commits into from Apr 26, 2022
Merged

Value or default bug #635

merged 14 commits into from Apr 26, 2022

Conversation

scottf
Copy link
Contributor

@scottf scottf commented Apr 22, 2022

addressing server defaults and unsigned ints better

@scottf scottf requested a review from tbeets April 22, 2022 00:27
@@ -175,7 +175,7 @@ public String toJson() {
JsonUtils.addField(sb, DELIVER_SUBJECT, deliverSubject);
JsonUtils.addField(sb, DELIVER_GROUP, deliverGroup);
JsonUtils.addField(sb, DELIVER_POLICY, GetOrDefault(deliverPolicy).toString());
JsonUtils.addField(sb, OPT_START_SEQ, startSeq);
JsonUtils.addUnsigned(sb, OPT_START_SEQ, startSeq);
Copy link
Contributor Author

@scottf scottf Apr 22, 2022

Choose a reason for hiding this comment

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

add as unsigned writes if the value is greater than 0 versus addField writes it if it's greater or equal to 0

Copy link

Choose a reason for hiding this comment

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

Naming of addUnsigned method seems confusing. Is not 0 (zero) an unsigned integer? Why would I expect a side-effect that 0 (zero) is ignored?

@@ -998,7 +998,7 @@ public enum CcChangeHelper {
}

public long valueOrDefault(Long val) {
return val == null ? START_SEQ.Default : val;
return val == null ? Default : val;
Copy link
Contributor Author

@scottf scottf Apr 22, 2022

Choose a reason for hiding this comment

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

the other code was just wrong. This was introduced in a previous 2.14.1 PR so has not been released yet

src/main/java/io/nats/client/impl/NatsJetStream.java Outdated Show resolved Hide resolved
Copy link

@tbeets tbeets left a comment

Choose a reason for hiding this comment

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

LGTM

@scottf scottf merged commit ce2c647 into main Apr 26, 2022
@scottf scottf deleted the value-or-default-bug branch April 26, 2022 11:46
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.

None yet

2 participants