cshannon commented on code in PR #4859:
URL: https://github.com/apache/accumulo/pull/4859#discussion_r1747463148


##########
core/src/main/java/org/apache/accumulo/core/lock/ServiceLockData.java:
##########
@@ -215,7 +222,37 @@ public static Optional<ServiceLockData> parse(byte[] 
lockData) {
     }
     String data = new String(lockData, UTF_8);
     return data.isBlank() ? Optional.empty()
-        : Optional.of(new ServiceLockData(GSON.get().fromJson(data, 
ServiceDescriptors.class)));
+        : Optional.of(new ServiceLockData(parseServiceDescriptors(data)));
+  }
+
+  public static ServiceDescriptors parseServiceDescriptors(String data) {
+    return deserialize(GSON.get().fromJson(data, 
ServiceDescriptorsGson.class));
+  }
+
+  private static ServiceDescriptors deserialize(ServiceDescriptorsGson json) {
+    return new ServiceDescriptors(json.descriptors.stream()
+        .map(s -> new ServiceDescriptor(s.uuid, s.service, s.address, s.group))
+        .collect(Collectors.toSet()));
   }
 
+  private static class ServiceDescriptorGson {

Review Comment:
   Yeah it was less refactoring to just copy to another object, like we have 
done in several other places. We could refactor ServiceDescriptor but then 
other parts of the code need updating



-- 
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]

Reply via email to