jack-moseley commented on a change in pull request #2969:
URL: https://github.com/apache/incubator-gobblin/pull/2969#discussion_r416356498
##########
File path:
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/RequesterService.java
##########
@@ -50,22 +55,27 @@ public RequesterService(Config config) {
*/
public static String serialize(List<ServiceRequester> requesterList) throws
IOException {
String jsonList = objectMapper.writeValueAsString(requesterList);
- String base64Str =
Base64.getEncoder().encodeToString(jsonList.getBytes("UTF-8"));
- return URLEncoder.encode(base64Str, "UTF-8");
+ String base64Str =
Base64.getEncoder().encodeToString(jsonList.getBytes(StandardCharsets.UTF_8));
+ return URLEncoder.encode(base64Str, StandardCharsets.UTF_8.name());
}
/**
* <p> This implementation decode a given string encoded by
* {@link #serialize(List)}.
*/
public static List<ServiceRequester> deserialize(String encodedString)
throws IOException {
- String base64Str = URLDecoder.decode(encodedString, "UTF-8");
+ String base64Str = URLDecoder.decode(encodedString,
StandardCharsets.UTF_8.name());
byte[] decodedBytes = Base64.getDecoder().decode(base64Str);
- String jsonList = new String(decodedBytes, "UTF-8");
+ String jsonList = new String(decodedBytes, StandardCharsets.UTF_8);
TypeReference<List<ServiceRequester>> mapType = new
TypeReference<List<ServiceRequester>>() {};
- List<ServiceRequester> requesterList = objectMapper.readValue(jsonList,
mapType);
- return requesterList;
+ return objectMapper.readValue(jsonList, mapType);
}
protected abstract List<ServiceRequester> findRequesters(BaseResource
resource);
+
+ /**
+ * This method should throw {@link FlowConfigLoggedException}, if the
requester is not allowed to make this request.
+ */
+ protected abstract void requesterAllowed(List<ServiceRequester>
originalRequesterList,
Review comment:
Maybe call this isRequesterAllowed and make it return boolean?
I know I made the original checkRequester throw exception, but this one's
only called from one place and is abstract, so it seems better to have a more
clear contract of returning boolean.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]