[ 
https://issues.apache.org/jira/browse/GOBBLIN-1132?focusedWorklogId=427993&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-427993
 ]

ASF GitHub Bot logged work on GOBBLIN-1132:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Apr/20 06:19
            Start Date: 28/Apr/20 06:19
    Worklog Time Spent: 10m 
      Work Description: 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 427993)
    Time Spent: 0.5h  (was: 20m)

> move logic of requester list validation to RequesterService implementation
> --------------------------------------------------------------------------
>
>                 Key: GOBBLIN-1132
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1132
>             Project: Apache Gobblin
>          Issue Type: Task
>            Reporter: Arjun Singh Bora
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to