You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/11/13 06:24:10 UTC

[GitHub] [zookeeper] zengchao1212 opened a new pull request #1536: ZOOKEEPER-4002:ZKAuditProvider throw NullPointerException if 'AUDIT_ENABLE' is false

zengchao1212 opened a new pull request #1536:
URL: https://github.com/apache/zookeeper/pull/1536


   


----------------------------------------------------------------
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] [zookeeper] maoling commented on a change in pull request #1536: ZOOKEEPER-4002:ZKAuditProvider throw NullPointerException if 'AUDIT_ENABLE' is false

Posted by GitBox <gi...@apache.org>.
maoling commented on a change in pull request #1536:
URL: https://github.com/apache/zookeeper/pull/1536#discussion_r523391828



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/audit/ZKAuditProvider.java
##########
@@ -68,7 +68,9 @@ public static boolean isAuditEnabled() {
 
     public static void log(String user, String operation, String znode, String acl,
                            String createMode, String session, String ip, Result result) {
-        auditLogger.logAuditEvent(createLogEvent(user, operation, znode, acl, createMode, session, ip, result));
+        if (isAuditEnabled()) {
+            auditLogger.logAuditEvent(createLogEvent(user, operation, znode, acl, createMode, session, ip, result));
+        }

Review comment:
       For this method, all the callers have a pre-check for the `isAuditEnabled`




----------------------------------------------------------------
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] [zookeeper] zengchao1212 commented on a change in pull request #1536: ZOOKEEPER-4002:ZKAuditProvider throw NullPointerException if 'AUDIT_ENABLE' is false

Posted by GitBox <gi...@apache.org>.
zengchao1212 commented on a change in pull request #1536:
URL: https://github.com/apache/zookeeper/pull/1536#discussion_r524909681



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/audit/ZKAuditProvider.java
##########
@@ -68,7 +68,9 @@ public static boolean isAuditEnabled() {
 
     public static void log(String user, String operation, String znode, String acl,
                            String createMode, String session, String ip, Result result) {
-        auditLogger.logAuditEvent(createLogEvent(user, operation, znode, acl, createMode, session, ip, result));
+        if (isAuditEnabled()) {
+            auditLogger.logAuditEvent(createLogEvent(user, operation, znode, acl, createMode, session, ip, result));
+        }

Review comment:
       Right,my mistake




----------------------------------------------------------------
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] [zookeeper] maoling commented on a change in pull request #1536: ZOOKEEPER-4002:ZKAuditProvider throw NullPointerException if 'AUDIT_ENABLE' is false

Posted by GitBox <gi...@apache.org>.
maoling commented on a change in pull request #1536:
URL: https://github.com/apache/zookeeper/pull/1536#discussion_r523392216



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/audit/ZKAuditProvider.java
##########
@@ -119,7 +121,9 @@ public static void addServerStartFailureAuditLog() {
     }
 
     private static void log(String user, String operation, Result result) {
-        auditLogger.logAuditEvent(createLogEvent(user, operation, result));
+        if (isAuditEnabled()) {
+            auditLogger.logAuditEvent(createLogEvent(user, operation, result));
+        }
     }

Review comment:
       This method is the same, when `'AUDIT_ENABLE'` is false, the program cannot run at here, so no NPE issue. Am I missing something?




----------------------------------------------------------------
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] [zookeeper] zengchao1212 closed pull request #1536: ZOOKEEPER-4002:ZKAuditProvider throw NullPointerException if 'AUDIT_ENABLE' is false

Posted by GitBox <gi...@apache.org>.
zengchao1212 closed pull request #1536:
URL: https://github.com/apache/zookeeper/pull/1536


   


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