mirror of https://github.com/apache/cloudstack.git
If the create command returns null for whatever reason, throw an exception so it aborts scheduling the async job to act on the created object
This commit is contained in:
parent
640a3dc239
commit
642b8a56f4
|
|
@ -83,6 +83,10 @@ public class ApiDispatcher {
|
|||
Method method = mgr.getClass().getMethod(methodName, cmd.getClass());
|
||||
Object dbObject = method.invoke(mgr, cmd);
|
||||
|
||||
if (dbObject == null) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Create method " + methodName + " in class " + cmd.getClass().getSimpleName() + " failed to create an object.");
|
||||
}
|
||||
|
||||
Method getIdMethod = dbObject.getClass().getMethod("getId");
|
||||
Object id = getIdMethod.invoke(dbObject);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue