Fixing NPE due to use of dependencies before Spring injection
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/02c75251 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/02c75251 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/02c75251 Branch: refs/heads/master Commit: 02c75251b33c74a9d7d2abe67effa1e6e2007dea Parents: cd8cada Author: Antonio Fornie <afor...@schubergphilis.com> Authored: Fri Aug 22 06:44:10 2014 -0500 Committer: wilderrodrigues <wrodrig...@schubergphilis.com> Committed: Tue Oct 14 15:08:09 2014 +0200 ---------------------------------------------------------------------- .../src/com/cloud/network/router/VpcNetworkHelperImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02c75251/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java b/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java index bbd08fd..aa57a54 100644 --- a/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java +++ b/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java @@ -23,6 +23,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.TreeSet; +import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.commons.lang.StringUtils; @@ -56,7 +57,13 @@ public class VpcNetworkHelperImpl extends NetworkHelperImpl { @Inject protected NicProfileHelper nicProfileHelper; - protected final String noHypervisorsErrMsgDetails = StringUtils.join(this.vpcMgr.getSupportedVpcHypervisors(), ','); + protected String noHypervisorsErrMsgDetails; + + @PostConstruct + protected void setupNoHypervisorsErrMsgDetails() { + this.noHypervisorsErrMsgDetails = StringUtils.join(this.vpcMgr.getSupportedVpcHypervisors(), ','); + this.noHypervisorsErrMsgDetails += " are the only supported Hypervisors"; + } @Override protected String getNoHypervisorsErrMsgDetails() {