[slf4j-dev] svn commit: r1185 - slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation

ravn at slf4j.org ravn at slf4j.org
Sat Oct 4 12:51:49 CEST 2008


Author: ravn
Date: Sat Oct  4 12:51:49 2008
New Revision: 1185

Modified:
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java

Log:
now handles arrays of arrays to see if the array base is a primitive (which Arrays.asList does not like)

Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java	(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java	Sat Oct  4 12:51:49 2008
@@ -55,14 +55,20 @@
 			}
 
 			CtClass parameterType = parameterTypes[i];
+			boolean isArray = parameterType.isArray();
 			CtClass arrayOf = parameterType.getComponentType();
+			if (isArray) {
+				while (arrayOf.isArray()) {
+					arrayOf = arrayOf.getComponentType();
+				}
+			}
 
 			sb.append(" + \"");
 			sb.append(parameterNameFor(method, locals, i));
 			sb.append("\" + \"=");
 
 			// use Arrays.asList() to render array of objects.
-			if (arrayOf != null && !arrayOf.isPrimitive()) {
+			if (isArray && !arrayOf.isPrimitive()) {
 				sb.append("\"+ java.util.Arrays.asList($" + (i + 1) + ")");
 			} else {
 				sb.append("\"+ $" + (i + 1));



More information about the slf4j-dev mailing list