The Loggers don't strip out the Exception if it's the last
element, so they actually *depend* on this ignoring the last odd element.
Revert my last change until I figure some reasonable compromise out.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2892 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2010-09-21 20:25:35 +00:00
parent 5cbde1b456
commit 48951845b3
@@ -51,8 +51,8 @@ public class LogBuilder
*/ */
public LogBuilder append (Object... args) public LogBuilder append (Object... args)
{ {
if (args != null) { if (args != null && args.length > 1) {
for (int ii = 0, nn = args.length; ii < nn; ii += 2) { for (int ii = 0, nn = args.length - (args.length % 2); ii < nn; ii += 2) {
if (_hasArgs) { if (_hasArgs) {
_log.append(", "); _log.append(", ");
} else { } else {
@@ -65,7 +65,7 @@ public class LogBuilder
} }
_log.append(args[ii]).append("="); _log.append(args[ii]).append("=");
try { try {
Object arg = args[ii + 1]; // this may cause ArrayIndexOutOfBoundsException Object arg = args[ii + 1];
_log.append(((arg == null) || !arg.getClass().isArray()) ? arg : arrayStr(arg)); _log.append(((arg == null) || !arg.getClass().isArray()) ? arg : arrayStr(arg));
} catch (Throwable t) { } catch (Throwable t) {
_log.append("<toString() failure: " + t + ">"); _log.append("<toString() failure: " + t + ">");