@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2012 the original author or authors .
* Copyright 2002 - 2013 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -325,18 +325,19 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
@@ -325,18 +325,19 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
while ( matcher . find ( ) ) {
String match = matcher . group ( ) ;
if ( PLACEHOLDER_METHOD_NAME . equals ( match ) ) {
matcher . appendReplacement ( output , escap e ( methodInvocation . getMethod ( ) . getName ( ) ) ) ;
matcher . appendReplacement ( output , Match er . quot eReplacement ( methodInvocation . getMethod ( ) . getName ( ) ) ) ;
}
else if ( PLACEHOLDER_TARGET_CLASS_NAME . equals ( match ) ) {
String className = getClassForLogging ( methodInvocation . getThis ( ) ) . getName ( ) ;
matcher . appendReplacement ( output , escap e ( className ) ) ;
matcher . appendReplacement ( output , Match er . quot eReplacement ( className ) ) ;
}
else if ( PLACEHOLDER_TARGET_CLASS_SHORT_NAME . equals ( match ) ) {
String shortName = ClassUtils . getShortName ( getClassForLogging ( methodInvocation . getThis ( ) ) ) ;
matcher . appendReplacement ( output , escap e ( shortName ) ) ;
matcher . appendReplacement ( output , Match er . quot eReplacement ( shortName ) ) ;
}
else if ( PLACEHOLDER_ARGUMENTS . equals ( match ) ) {
matcher . appendReplacement ( output , escape ( StringUtils . arrayToCommaDelimitedString ( methodInvocation . getArguments ( ) ) ) ) ;
matcher . appendReplacement ( output ,
Matcher . quoteReplacement ( StringUtils . arrayToCommaDelimitedString ( methodInvocation . getArguments ( ) ) ) ) ;
}
else if ( PLACEHOLDER_ARGUMENT_TYPES . equals ( match ) ) {
appendArgumentTypes ( methodInvocation , matcher , output ) ;
@ -345,7 +346,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
@@ -345,7 +346,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
appendReturnValue ( methodInvocation , matcher , output , returnValue ) ;
}
else if ( throwable ! = null & & PLACEHOLDER_EXCEPTION . equals ( match ) ) {
matcher . appendReplacement ( output , escap e ( throwable . toString ( ) ) ) ;
matcher . appendReplacement ( output , Match er . quot eReplacement ( throwable . toString ( ) ) ) ;
}
else if ( PLACEHOLDER_INVOCATION_TIME . equals ( match ) ) {
matcher . appendReplacement ( output , Long . toString ( invocationTime ) ) ;
@ -379,7 +380,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
@@ -379,7 +380,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
matcher . appendReplacement ( output , "null" ) ;
}
else {
matcher . appendReplacement ( output , escap e ( returnValue . toString ( ) ) ) ;
matcher . appendReplacement ( output , Match er . quot eReplacement ( returnValue . toString ( ) ) ) ;
}
}
@ -399,7 +400,8 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
@@ -399,7 +400,8 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
for ( int i = 0 ; i < argumentTypeShortNames . length ; i + + ) {
argumentTypeShortNames [ i ] = ClassUtils . getShortName ( argumentTypes [ i ] ) ;
}
matcher . appendReplacement ( output , escape ( StringUtils . arrayToCommaDelimitedString ( argumentTypeShortNames ) ) ) ;
matcher . appendReplacement ( output ,
Matcher . quoteReplacement ( StringUtils . arrayToCommaDelimitedString ( argumentTypeShortNames ) ) ) ;
}
/ * *
@ -417,27 +419,4 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
@@ -417,27 +419,4 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
}
}
/ * *
* Replaces { @code $ } in inner class names with { @code \ $ } .
* < p > This code is equivalent to JDK 1 . 5 ' s { @code quoteReplacement }
* method in the Matcher class itself . We ' re keeping our own version
* here for JDK 1 . 4 compliance reasons only .
* /
private String escape ( String input ) {
StringBuilder sb = new StringBuilder ( ) ;
for ( int i = 0 ; i < input . length ( ) ; i + + ) {
char c = input . charAt ( i ) ;
if ( c = = '\\' ) {
sb . append ( "\\\\" ) ;
}
else if ( c = = '$' ) {
sb . append ( "\\$" ) ;
}
else {
sb . append ( c ) ;
}
}
return sb . toString ( ) ;
}
}