fix checkstyle & add license

This commit is contained in:
xiezhineng 2023-03-10 10:07:46 +08:00
parent 059c655584
commit bc47cf6e25
1 changed files with 21 additions and 3 deletions

View File

@ -1,3 +1,21 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs.server.federation.router.security; package org.apache.hadoop.hdfs.server.federation.router.security;
import org.apache.hadoop.classification.VisibleForTesting; import org.apache.hadoop.classification.VisibleForTesting;
@ -14,7 +32,7 @@ import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_CALLER_C
public class RouterSecurityAuditLogger { public class RouterSecurityAuditLogger {
public static final Logger auditLog = LoggerFactory.getLogger( public static final Logger AUDIT_LOG = LoggerFactory.getLogger(
RouterSecurityManager.class.getName() + ".audit"); RouterSecurityManager.class.getName() + ".audit");
private static final ThreadLocal<StringBuilder> STRING_BUILDER = private static final ThreadLocal<StringBuilder> STRING_BUILDER =
@ -40,7 +58,7 @@ public class RouterSecurityAuditLogger {
public void logAuditEvent(boolean succeeded, String userName, public void logAuditEvent(boolean succeeded, String userName,
InetAddress addr, String cmd, InetAddress addr, String cmd,
CallerContext callerContext, String tokenId) { CallerContext callerContext, String tokenId) {
if (auditLog.isDebugEnabled() || auditLog.isInfoEnabled()) { if (AUDIT_LOG.isDebugEnabled() || AUDIT_LOG.isInfoEnabled()) {
logAuditMessage( logAuditMessage(
creatAuditLog(succeeded, userName, addr, cmd, callerContext, creatAuditLog(succeeded, userName, addr, cmd, callerContext,
tokenId)); tokenId));
@ -85,7 +103,7 @@ public class RouterSecurityAuditLogger {
} }
private void logAuditMessage(String message) { private void logAuditMessage(String message) {
auditLog.info(message); AUDIT_LOG.info(message);
} }
} }