Repository: incubator-stratos Updated Branches: refs/heads/master 8990923bd -> 7d92e736c
fixing a possible NPE, when the class name is null Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/3d32585c Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/3d32585c Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/3d32585c Branch: refs/heads/master Commit: 3d32585c302c3c931815c013fb223a788b86963a Parents: 78c7dd2 Author: Nirmal Fernando <[email protected]> Authored: Thu Apr 17 02:55:47 2014 +0530 Committer: Nirmal Fernando <[email protected]> Committed: Thu Apr 17 02:55:47 2014 +0530 ---------------------------------------------------------------------- .../stratos/cloud/controller/util/CloudControllerUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3d32585c/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java index 2c9738e..a213adf 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java @@ -246,6 +246,14 @@ public class CloudControllerUtil { private static Iaas loadIaas(IaasProvider iaasProvider) throws InvalidIaasProviderException { try { + + if(iaasProvider.getClassName() == null) { + String msg = "You have not specified a class which represents the iaas of type: [" + + iaasProvider.getType() + "]."; + log.error(msg); + throw new InvalidIaasProviderException(msg); + } + Constructor<?> c = Class.forName(iaasProvider.getClassName()) .getConstructor(IaasProvider.class); Iaas iaas = (Iaas) c.newInstance(iaasProvider);
