Skip to content

Commit b3aca7f

Browse files
authored
Merge pull request #401 from valepakh/stringify
Don't clear highest bit in member id string representation
2 parents bc4cc85 + e9c7b6a commit b3aca7f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

cluster-api/src/main/java/io/scalecube/cluster/Member.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void readExternal(ObjectInput in) throws IOException {
132132
private static String stringifyId(String id) {
133133
try {
134134
final UUID uuid = UUID.fromString(id);
135-
return Long.toHexString(uuid.getMostSignificantBits() & Long.MAX_VALUE);
135+
return Long.toHexString(uuid.getMostSignificantBits());
136136
} catch (Exception ex) {
137137
return id;
138138
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.scalecube.cluster;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import java.util.UUID;
6+
import org.junit.jupiter.api.Test;
7+
8+
public class MemberTest {
9+
10+
@Test
11+
public void testMemberString() {
12+
UUID id = UUID.fromString("879162b5-0300-401a-9df3-18ca1f7df990");
13+
Member member = new Member(id.toString(), "alias", "address", "namespace");
14+
assertEquals("namespace:alias:879162b50300401a@address", member.toString());
15+
}
16+
}

0 commit comments

Comments
 (0)