keith-turner commented on code in PR #5262:
URL: https://github.com/apache/accumulo/pull/5262#discussion_r1938333511
##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/FateLock.java:
##########
@@ -76,26 +77,10 @@ private FateLockEntry(LockType lockType, FateId fateId) {
this.fateId = Objects.requireNonNull(fateId);
}
- private FateLockEntry(byte[] entry) {
- if (entry == null || entry.length < 1) {
- throw new IllegalArgumentException();
- }
-
- int split = -1;
- for (int i = 0; i < entry.length; i++) {
- if (entry[i] == ':') {
- split = i;
- break;
- }
- }
-
- if (split == -1) {
- throw new IllegalArgumentException();
- }
-
- this.lockType = LockType.valueOf(new String(entry, 0, split, UTF_8));
- this.fateId =
- FateId.from(new String(Arrays.copyOfRange(entry, split + 1,
entry.length), UTF_8));
+ private FateLockEntry(String entry) {
+ var fields = entry.split(":", 2);
Review Comment:
That just grabs the first two splits even if there are more. The FateId
also has a `:` so calling split w/o the 2 will return three fields.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]