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:
parent
e12613a018
commit
e0b9d21520
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user