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:
Kris McQueen 2010-10-28 17:50:44 -07:00
parent 640a3dc239
commit 642b8a56f4
1 changed files with 4 additions and 0 deletions

View File

@ -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);