Delay getting CurrentUser in RequestScopePropagator

If the Callable doesn't ask for the CurrentUser, avoid getting it
from the supplied RequestContext. This works around contexts that
have no CurrnetUser and throw from getCurrentUser() if invoked.

Change-Id: I4d1ccbc77b29589d7553a0e296687dca4bb2af7a
This commit is contained in:
Shawn O. Pearce
2012-11-21 14:32:15 -08:00
parent f0b9888bd5
commit a2fc148f55

View File

@@ -175,11 +175,10 @@ public abstract class RequestScopePropagator {
return new Callable<T>() {
@Override
public T call() throws Exception {
final CurrentUser user = context.getCurrentUser();
RequestContext old = local.setContext(new RequestContext() {
@Override
public CurrentUser getCurrentUser() {
return user;
return context.getCurrentUser();
}
@Override