Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

64785: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (4.3/Cloud)
      64131: Merged DEV to V4.2-BUG-FIX (4.2.2)
         63233: MNT-10767: Guard in AuditMethodInterceptor is too restrictive preventing subordinate service calls from producing data.
          - Modify AuditMethodInterceptor to audit subordinate public services 
         64123: MNT-10767: Guard in AuditMethodInterceptor is too restrictive preventing subordinate service calls from producing data.
          - Add unit test 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@66188 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-04-02 19:53:27 +00:00
parent 5a833ba4ac
commit 23182c909d
6 changed files with 159 additions and 6 deletions

View File

@@ -187,7 +187,7 @@ public class AuditMethodInterceptor implements MethodInterceptor
try
{
// If we are already in a nested audit call, there is nothing to do
if (wasInAudit != null)
if (Boolean.TRUE.equals(wasInAudit))
{
return mi.proceed();
}
@@ -211,8 +211,6 @@ public class AuditMethodInterceptor implements MethodInterceptor
}
String methodName = mi.getMethod().getName();
// Record that we have entered an audit method
inAudit.set(Boolean.TRUE);
return proceedWithAudit(mi, auditableDef, serviceName, methodName, namedArguments);
}
finally
@@ -228,7 +226,10 @@ public class AuditMethodInterceptor implements MethodInterceptor
String methodName,
Map<String, Serializable> namedArguments) throws Throwable
{
Boolean wasInAudit = inAudit.get();
Map<String, Serializable> preAuditedData = null;
// Record that we have entered an audit method
inAudit.set(Boolean.TRUE);
try
{
preAuditedData = auditInvocationBefore(serviceName, methodName, namedArguments);
@@ -241,7 +242,10 @@ public class AuditMethodInterceptor implements MethodInterceptor
" Invocation: " + mi,
e);
}
finally
{
inAudit.set(wasInAudit);
}
// Execute the call
Object ret = null;
Throwable thrown = null;
@@ -256,6 +260,8 @@ public class AuditMethodInterceptor implements MethodInterceptor
// We don't ALWAYS want to record the return value
Object auditRet = auditableDef.recordReturnedObject() ? ret : null;
// Record that we have entered an audit method
inAudit.set(Boolean.TRUE);
try
{
auditInvocationAfter(serviceName, methodName, namedArguments, auditRet, thrown, preAuditedData);
@@ -268,7 +274,10 @@ public class AuditMethodInterceptor implements MethodInterceptor
" Invocation: " + mi,
e);
}
finally
{
inAudit.set(wasInAudit);
}
// Done
if (thrown != null)
{