Repository: cloudstack Updated Branches: refs/heads/master 624139d8e -> e431538b0
findbugs possible nullpointer mitigated Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e431538b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e431538b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e431538b Branch: refs/heads/master Commit: e431538b0a59d4bedad1fcf23ded89816f991a64 Parents: 624139d Author: Daan Hoogland <dhoogl...@schubergphilis.com> Authored: Wed Feb 26 11:56:49 2014 +0100 Committer: Daan Hoogland <dhoogl...@schubergphilis.com> Committed: Wed Feb 26 11:56:49 2014 +0100 ---------------------------------------------------------------------- server/src/com/cloud/api/ApiServer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e431538b/server/src/com/cloud/api/ApiServer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index f0fc372..ba58b52 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -366,9 +366,13 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer Class<?> cmdClass = getCmdClass(command[0]); - APICommand annotation = cmdClass.getAnnotation(APICommand.class); - if (cmdClass != null) { + APICommand annotation = cmdClass.getAnnotation(APICommand.class); + if (annotation == null) { + s_logger.error("No APICommand annotation found for class " + cmdClass.getCanonicalName()); + throw new CloudRuntimeException("No APICommand annotation found for class " + cmdClass.getCanonicalName()); + } + BaseCmd cmdObj = (BaseCmd)cmdClass.newInstance(); cmdObj = ComponentContext.inject(cmdObj); cmdObj.configure();