aratno commented on code in PR #3728:
URL: https://github.com/apache/cassandra/pull/3728#discussion_r1890671957
##########
src/java/org/apache/cassandra/audit/AuditLogManager.java:
##########
@@ -398,4 +418,103 @@ else if (e instanceof
PasswordGuardrail.PasswordGuardrailException)
return PasswordObfuscator.obfuscate(e.getMessage());
}
+
+ private static class JmxFormatter
+ {
+ private static String user(Subject subject)
+ {
+ return String.format("%s", subject == null ? null :
subject.getPrincipals().stream().map(Objects::toString).collect(Collectors.joining(",
")));
+ }
+
+ private static String method(Method method, Object[] args)
+ {
+ Function<Object, String> fmt = obj -> {
+ if (obj == null)
+ return "null";
+ return obj.toString();
+ };
+ String argsFmt = "";
+ if (args != null)
+ argsFmt =
Arrays.stream(args).map(fmt).collect(Collectors.joining(", "));
+ return String.format("%s#%s(%s)",
method.getDeclaringClass().getCanonicalName(), method.getName(), argsFmt);
+ }
Review Comment:
This will reuse the same allocation, but create a new reference on the stack
to the anonymous class that the lambda compiles into. Fully agree with the
stylistic comment here though, updated.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]