From cec8ebd5cdb4e7102d1138983089c2c2f214801e Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 19 Nov 2010 18:13:07 -0800 Subject: [PATCH] bug 7236: don't catch AsyncCommandQueued exception in ApiDispatcher status 7236: resolved fixed --- server/src/com/cloud/api/ApiDispatcher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index d0f63e337ec..92971f35560 100644 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -28,6 +28,7 @@ import java.util.StringTokenizer; import org.apache.log4j.Logger; import com.cloud.api.BaseCmd.CommandType; +import com.cloud.async.AsyncCommandQueued; import com.cloud.exception.AccountLimitException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; @@ -80,6 +81,8 @@ public class ApiDispatcher { throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, t.getMessage()); }else if (t instanceof ServerApiException) { throw new ServerApiException(((ServerApiException) t).getErrorCode(), ((ServerApiException) t).getDescription()); + }else if (t instanceof AsyncCommandQueued) { + throw (AsyncCommandQueued)t; }else { s_logger.error("Exception while executing " + cmd.getClass().getSimpleName() + ":", t); if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN) @@ -109,7 +112,9 @@ public class ApiDispatcher { throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, t.getMessage()); }else if (t instanceof ServerApiException) { throw new ServerApiException(((ServerApiException) t).getErrorCode(), ((ServerApiException) t).getDescription()); - } else { + } else if (t instanceof AsyncCommandQueued) { + throw (AsyncCommandQueued)t; + }else { s_logger.error("Exception while executing " + cmd.getClass().getSimpleName() + ":", t); if (UserContext.current().getAccount() == null || UserContext.current().getAccount().getType() == Account.ACCOUNT_TYPE_ADMIN) throw new ServerApiException(BaseCmd.INTERNAL_ERROR, t.getMessage());