TaoZex commented on code in PR #3351:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3351#discussion_r1017775823


##########
seatunnel-connectors-v2/connector-http/connector-http-myhours/src/main/java/org/apache/seatunnel/connectors/seatunnel/myhours/source/config/MyHoursSourceParameter.java:
##########
@@ -29,36 +28,27 @@
 public class MyHoursSourceParameter extends HttpParameter {
     public void buildWithConfig(Config pluginConfig, String accessToken) {
         super.buildWithConfig(pluginConfig);
-        //put authorization in headers
+        // put authorization in headers
         this.headers = this.getHeaders() == null ? new HashMap<>() : 
this.getHeaders();
-        this.headers.put(MyHoursSourceConfig.AUTHORIZATION, 
MyHoursSourceConfig.ACCESSTOKEN_PREFIX + " " + accessToken);
+        this.headers.put(MyHoursSourceConfig.AUTHORIZATION, 
MyHoursSourceConfig.ACCESS_TOKEN_PREFIX + " " + accessToken);
         this.setHeaders(this.headers);
     }
 
     public void buildWithLoginConfig(Config pluginConfig) {
+        super.buildWithConfig(pluginConfig);

Review Comment:
   How about writing set retry as a separate method? This line of code only 
uses the set retry part, and other connectors can be reused in the future.



##########
seatunnel-connectors-v2/connector-http/connector-http-myhours/src/main/java/org/apache/seatunnel/connectors/seatunnel/myhours/source/MyHoursSource.java:
##########
@@ -55,12 +54,13 @@ public String getPluginName() {
 
     @Override
     public void prepare(Config pluginConfig) throws PrepareFailException {
-        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, 
MyHoursSourceConfig.URL, MyHoursSourceConfig.EMAIL, 
MyHoursSourceConfig.PASSWORD);
+        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, 
MyHoursSourceConfig.URL.key(),
+                MyHoursSourceConfig.EMAIL.key(), 
MyHoursSourceConfig.PASSWORD.key());
         if (!result.isSuccess()) {
             throw new PrepareFailException(getPluginName(), PluginType.SOURCE, 
result.getMsg());
         }
         //Login to get accessToken
-        String accessToken = null;
+        String accessToken;
         accessToken = getAccessToken(pluginConfig);

Review Comment:
   ```suggestion
           String accessToken = getAccessToken(pluginConfig);
   ```



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