mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
bug 7298: throw an Exception when invalid job Id is specified in queryAsyncJobResult
status 7298: resolved fixed
This commit is contained in:
parent
40c3a0afa2
commit
cb74030d01
@ -2248,7 +2248,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJobResponse queryJobResult(QueryAsyncJobResultCmd cmd) {
|
||||
public AsyncJobResponse queryJobResult(QueryAsyncJobResultCmd cmd) throws InvalidParameterValueException{
|
||||
AsyncJobResult result = ApiDBUtils._asyncMgr.queryAsyncJobResult(cmd);
|
||||
AsyncJobResponse response = new AsyncJobResponse();
|
||||
response.setId(result.getJobId());
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
package com.cloud.async;
|
||||
|
||||
import com.cloud.api.commands.QueryAsyncJobResultCmd;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
public interface AsyncJobManager extends Manager {
|
||||
@ -43,5 +45,5 @@ public interface AsyncJobManager extends Manager {
|
||||
* @param cmd the command that specifies the job id
|
||||
* @return an async-call result object
|
||||
*/
|
||||
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd);
|
||||
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ import com.cloud.api.response.ExceptionResponse;
|
||||
import com.cloud.async.dao.AsyncJobDao;
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.maid.StackMaid;
|
||||
import com.cloud.user.Account;
|
||||
@ -260,7 +261,11 @@ public class AsyncJobManagerImpl implements AsyncJobManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd) throws PermissionDeniedException {
|
||||
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
AsyncJobVO job = _jobDao.findById(cmd.getId());
|
||||
if (job == null) {
|
||||
throw new InvalidParameterValueException("Unable to find a job by id " + cmd.getId());
|
||||
}
|
||||
return queryAsyncJobResult(cmd.getId());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user