Fix a bug where DefaultPromise.toString() says 'incomplete' when it's done

Motivation:

DefaultPromise.toString() returns 'DefaultPromise(incomplete)' when it's
actually complete with non-null result.

Modifications:

Handle the case where the promise is done and its result is non-null in
toString()

Result:

The String returned by DefaultPromise.toString() is not confusing
anymore.
This commit is contained in:
Trustin Lee 2015-10-30 11:47:11 +09:00 committed by Norman Maurer
parent c9364616c8
commit d0f3cd383d

View File

@ -817,12 +817,17 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
} else if (result == UNCANCELLABLE) {
buf.append("(uncancellable)");
} else if (result instanceof CauseHolder) {
buf.append("(failure(")
buf.append("(failure: ")
.append(((CauseHolder) result).cause)
.append(')');
} else if (result != null) {
buf.append("(success: ")
.append(result)
.append(')');
} else {
buf.append("(incomplete)");
}
return buf;
}