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

issue with kvmsg get/set operation #940

Closed
ThomasCraigNelson opened this issue Jan 17, 2023 · 2 comments
Closed

issue with kvmsg get/set operation #940

ThomasCraigNelson opened this issue Jan 17, 2023 · 2 comments

Comments

@ThomasCraigNelson
Copy link

Note the following test
@test
public void showKmsgIssueTest()
{
kvmsg msg = new kvmsg(0);
msg.setKey("mykey");
kvmsg clone = msg.dup();
clone.setKey(clone.getKey() + "theirkey");
// This should pass but does not in 0.5.3:
assert(clone.getKey().equals("mykeytheirkey"));
}
However with the following change in kvmsg it passes:
// Set message getKey as provided
public void setKey(String key)
{
byte[] msg = new byte[key.length()];
System.arraycopy(key.getBytes(ZMQ.CHARSET), 0, msg, 0, key.length());
frame[FRAME_KEY] = msg;
present[FRAME_KEY] = true;
this.key = null;// THIS LINE FIXES the test. Used in later getKey optimization....
}

@trevorbernard
Copy link
Member

Feel free to submit a PR fixing this issue

@trevorbernard
Copy link
Member

Resolved

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

No branches or pull requests

2 participants