You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2021/05/18 15:49:34 UTC

[GitHub] [zeppelin] cuspymd opened a new pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

cuspymd opened a new pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121


   ### What is this PR for?
   Polish server and service package codes of zeppelin-server
   - Delete unused import
   - Delete and optimize redundant codes
   - Add `final` keyword to some variables that have unchanged reference.
   
   ### What type of PR is it?
   [Refactoring]
   
   ### What is the Jira issue?
   * [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server
   
   ### How should this be tested?
   * CI
   
   ### Questions:
   * Does the licenses files need update? No
   * Is there breaking changes for older versions? No
   * Does this needs documentation? No
   


-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] zjffdu commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
zjffdu commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r634876522



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroAuthenticationService.java
##########
@@ -407,8 +407,8 @@ public boolean isAuthenticated() {
     Connection con = null;
     PreparedStatement ps = null;
     ResultSet rs = null;
-    DataSource dataSource = null;
-    String authQuery = "";
+    DataSource dataSource;
+    String authQuery;

Review comment:
       Only change these 2 variables ?




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] zjffdu commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
zjffdu commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r635330507



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/NoAuthenticationService.java
##########
@@ -30,7 +30,7 @@
 import org.slf4j.LoggerFactory;
 
 public class NoAuthenticationService implements AuthenticationService {
-  private static Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);
+  private static final Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);

Review comment:
       I think the logger in google java style document refer to `java.util.logging.Logger` which is a class and do has method to change its state (e.g. Logger#config). But what zeppelin use is `org.slf4j.Logger` is an interface which has no method to change its state. 




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] cuspymd commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
cuspymd commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r636196272



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/NoAuthenticationService.java
##########
@@ -30,7 +30,7 @@
 import org.slf4j.LoggerFactory;
 
 public class NoAuthenticationService implements AuthenticationService {
-  private static Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);
+  private static final Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);

Review comment:
       I changed it.




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] cuspymd commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
cuspymd commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r635299987



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroAuthenticationService.java
##########
@@ -407,8 +407,8 @@ public boolean isAuthenticated() {
     Connection con = null;
     PreparedStatement ps = null;
     ResultSet rs = null;
-    DataSource dataSource = null;
-    String authQuery = "";
+    DataSource dataSource;
+    String authQuery;

Review comment:
       In the case of `con`, `ps`, and `rs` variables, they are used in the `finally` block, so if not initialized, a compilation error occurs.




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] cuspymd commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
cuspymd commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r635277266



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/NoAuthenticationService.java
##########
@@ -30,7 +30,7 @@
 import org.slf4j.LoggerFactory;
 
 public class NoAuthenticationService implements AuthenticationService {
-  private static Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);
+  private static final Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);

Review comment:
       In the example in the [Constant names](https://google.github.io/styleguide/javaguide.html#s5.2.4-constant-names) section of the Google java style document, it says that `Logger` is not a constant. Could you check it out again?
   > // Not constants
   ...
   static final Logger logger = Logger.getLogger(MyClass.getName());




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] Reamer commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
Reamer commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r635848055



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/JobManagerService.java
##########
@@ -65,9 +65,10 @@ public JobManagerService(Notebook notebook,
     Note jobNote = notebook.getNote(noteId);
     if (jobNote == null) {
       callback.onFailure(new IOException("Note " + noteId + " not found"), context);
+    } else {
+      notesJobInfo.add(new NoteJobInfo(jobNote));
+      callback.onSuccess(notesJobInfo, context);

Review comment:
       This is a change of programme. But it looks good.




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] zjffdu commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
zjffdu commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r634876091



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/NoAuthenticationService.java
##########
@@ -30,7 +30,7 @@
 import org.slf4j.LoggerFactory;
 
 public class NoAuthenticationService implements AuthenticationService {
-  private static Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);
+  private static final Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);

Review comment:
       Rename it to be `LOGGER`, this is our convention for static final variables. 

##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/NoAuthenticationService.java
##########
@@ -30,7 +30,7 @@
 import org.slf4j.LoggerFactory;
 
 public class NoAuthenticationService implements AuthenticationService {
-  private static Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);
+  private static final Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);

Review comment:
       Rename it to be `LOGGER`, this is our naming convention for static final variables. 




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] asfgit closed pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121


   


-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] zjffdu commented on a change in pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
zjffdu commented on a change in pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#discussion_r635330507



##########
File path: zeppelin-server/src/main/java/org/apache/zeppelin/service/NoAuthenticationService.java
##########
@@ -30,7 +30,7 @@
 import org.slf4j.LoggerFactory;
 
 public class NoAuthenticationService implements AuthenticationService {
-  private static Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);
+  private static final Logger logger = LoggerFactory.getLogger(NoAuthenticationService.class);

Review comment:
       I think the logger in google java style document refer to `java.util.logging.Logger` which is a class and do has method to change its state (e.g. Logger#config). But what zeppelin use is `org.slf4j.Logger` which is an interface and has no method to change its state. 




-- 
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:
users@infra.apache.org



[GitHub] [zeppelin] zjffdu commented on pull request #4121: [ZEPPELIN-5376] Polish server and service package codes of zeppelin-server

Posted by GitBox <gi...@apache.org>.
zjffdu commented on pull request #4121:
URL: https://github.com/apache/zeppelin/pull/4121#issuecomment-855250956


   LGTM


-- 
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:
users@infra.apache.org