Skip to content

Don't clear highest bit in member id string representation #401

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cluster-api/src/main/java/io/scalecube/cluster/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void readExternal(ObjectInput in) throws IOException {
private static String stringifyId(String id) {
try {
final UUID uuid = UUID.fromString(id);
return Long.toHexString(uuid.getMostSignificantBits() & Long.MAX_VALUE);
return Long.toHexString(uuid.getMostSignificantBits());
} catch (Exception ex) {
return id;
}
Expand Down
16 changes: 16 additions & 0 deletions cluster/src/test/java/io/scalecube/cluster/MemberTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.scalecube.cluster;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.UUID;
import org.junit.jupiter.api.Test;

public class MemberTest {

@Test
public void testMemberString() {
UUID id = UUID.fromString("879162b5-0300-401a-9df3-18ca1f7df990");
Member member = new Member(id.toString(), "alias", "address", "namespace");
assertEquals("namespace:alias:879162b50300401a@address", member.toString());
}
}