Bug 1058136 - Fix debug logging crash; r=cpeterson

This commit is contained in:
Jim Chen
2014-09-04 14:38:17 -04:00
parent 4a7625bd8a
commit f12f4ca421
2 changed files with 23 additions and 19 deletions

View File

@@ -1039,11 +1039,13 @@ final class GeckoEditable
if (DEBUG) { if (DEBUG) {
StringBuilder log = new StringBuilder(method.getName()); StringBuilder log = new StringBuilder(method.getName());
log.append("("); log.append("(");
for (Object arg : args) { if (args != null) {
debugAppend(log, arg).append(", "); for (Object arg : args) {
} debugAppend(log, arg).append(", ");
if (args.length > 0) { }
log.setLength(log.length() - 2); if (args.length > 0) {
log.setLength(log.length() - 2);
}
} }
if (method.getReturnType().equals(Void.TYPE)) { if (method.getReturnType().equals(Void.TYPE)) {
log.append(")"); log.append(")");

View File

@@ -1024,21 +1024,23 @@ final class DebugGeckoInputConnection
StringBuilder log = new StringBuilder(mCallLevel); StringBuilder log = new StringBuilder(mCallLevel);
log.append("> ").append(method.getName()).append("("); log.append("> ").append(method.getName()).append("(");
for (Object arg : args) { if (args != null) {
// translate argument values to constant names for (Object arg : args) {
if ("notifyIME".equals(method.getName()) && arg == args[0]) { // translate argument values to constant names
log.append(GeckoEditable.getConstantName( if ("notifyIME".equals(method.getName()) && arg == args[0]) {
GeckoEditableListener.class, "NOTIFY_IME_", arg)); log.append(GeckoEditable.getConstantName(
} else if ("notifyIMEContext".equals(method.getName()) && arg == args[0]) { GeckoEditableListener.class, "NOTIFY_IME_", arg));
log.append(GeckoEditable.getConstantName( } else if ("notifyIMEContext".equals(method.getName()) && arg == args[0]) {
GeckoEditableListener.class, "IME_STATE_", arg)); log.append(GeckoEditable.getConstantName(
} else { GeckoEditableListener.class, "IME_STATE_", arg));
GeckoEditable.debugAppend(log, arg); } else {
GeckoEditable.debugAppend(log, arg);
}
log.append(", ");
}
if (args.length > 0) {
log.setLength(log.length() - 2);
} }
log.append(", ");
}
if (args.length > 0) {
log.setLength(log.length() - 2);
} }
log.append(")"); log.append(")");
Log.d(LOGTAG, log.toString()); Log.d(LOGTAG, log.toString());