diff --git a/apollo-audit/apollo-audit-impl/src/main/java/com/ctrip/framework/apollo/audit/aop/ApolloAuditSpanAspect.java b/apollo-audit/apollo-audit-impl/src/main/java/com/ctrip/framework/apollo/audit/aop/ApolloAuditSpanAspect.java index 533e2172ad3..054d637139b 100644 --- a/apollo-audit/apollo-audit-impl/src/main/java/com/ctrip/framework/apollo/audit/aop/ApolloAuditSpanAspect.java +++ b/apollo-audit/apollo-audit-impl/src/main/java/com/ctrip/framework/apollo/audit/aop/ApolloAuditSpanAspect.java @@ -50,8 +50,9 @@ public Object around(ProceedingJoinPoint pjp, ApolloAuditLog auditLog) throws Th String opName = auditLog.name(); try (AutoCloseable scope = api.appendAuditLog(auditLog.type(), opName, auditLog.description())) { + Object proceed = pjp.proceed(); auditDataInfluenceArg(pjp); - return pjp.proceed(); + return proceed; } } @@ -96,22 +97,18 @@ Method findMethod(ProceedingJoinPoint pjp) { } void parseArgAndAppend(String entityName, String fieldName, Object arg) { - if (entityName == null || fieldName == null) { + if (entityName == null || fieldName == null || arg == null) { return; } - Collection parsedList = new ArrayList<>(Collections.emptyList()); if (arg instanceof Collection) { - /* if arg is a collection */ - parsedList.addAll((Collection) arg); + for (Object o : (Collection) arg) { + String matchedValue = String.valueOf(o); + api.appendDataInfluence(entityName, ApolloAuditConstants.ANY_MATCHED_ID, fieldName, matchedValue); + } } else { - parsedList.add(arg); - } - - for (Object o : parsedList) { - String matchedValue = String.valueOf(o); - api.appendDataInfluence(entityName, ApolloAuditConstants.ANY_MATCHED_ID, fieldName, - matchedValue); + String matchedValue = String.valueOf(arg); + api.appendDataInfluence(entityName, ApolloAuditConstants.ANY_MATCHED_ID, fieldName, matchedValue); } } }