You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/01/13 12:16:56 UTC
[5/5] git commit: updated refs/heads/master to 3bea604
Fix coverity issue 600070
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/15a08107
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/15a08107
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/15a08107
Branch: refs/heads/master
Commit: 15a08107d8554b32edd9b566fe70c6b65a2d6597
Parents: 4683de5
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Mon Jan 13 11:53:50 2014 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Mon Jan 13 12:16:37 2014 +0100
----------------------------------------------------------------------
.../com/cloud/network/nicira/NiciraNvpApi.java | 35 +++++++++-----------
1 file changed, 16 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15a08107/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
index e58dcb9..92c23eb 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
@@ -71,6 +71,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
+@SuppressWarnings("rawtypes")
public class NiciraNvpApi {
protected static final String GET_METHOD_TYPE = "get";
protected static final String DELETE_METHOD_TYPE = "delete";
@@ -98,14 +99,27 @@ public class NiciraNvpApi {
private final Gson gson;
- @SuppressWarnings("rawtypes")
protected static Map<Class, String> prefixMap;
- @SuppressWarnings("rawtypes")
protected static Map<Class, Type> listTypeMap;
protected static Map<String, String> defaultListParams;
+ static {
+ prefixMap = new HashMap<Class, String>();
+ prefixMap.put(SecurityProfile.class, SEC_PROFILE_URI_PREFIX);
+ prefixMap.put(Acl.class, ACL_URI_PREFIX);
+
+ listTypeMap = new HashMap<Class, Type>();
+ listTypeMap.put(SecurityProfile.class, new TypeToken<NiciraNvpList<SecurityProfile>>() {
+ }.getType());
+ listTypeMap.put(Acl.class, new TypeToken<NiciraNvpList<Acl>>() {
+ }.getType());
+
+ defaultListParams = new HashMap<String, String>();
+ defaultListParams.put("fields", "*");
+ }
+
/* This factory method is protected so we can extend this
* in the unittests.
*/
@@ -147,23 +161,6 @@ public class NiciraNvpApi {
}
gson = new GsonBuilder().registerTypeAdapter(NatRule.class, new NatRuleAdapter()).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
- buildTypeSpecificStructures();
- }
-
- @SuppressWarnings("rawtypes")
- protected void buildTypeSpecificStructures() {
- if (prefixMap == null || listTypeMap == null || defaultListParams == null) {
- prefixMap = new HashMap<Class, String>();
- prefixMap.put(SecurityProfile.class, SEC_PROFILE_URI_PREFIX);
- prefixMap.put(Acl.class, ACL_URI_PREFIX);
-
- listTypeMap = new HashMap<Class, Type>();
- listTypeMap.put(SecurityProfile.class, new TypeToken<NiciraNvpList<SecurityProfile>>() {}.getType());
- listTypeMap.put(Acl.class, new TypeToken<NiciraNvpList<Acl>>() {}.getType());
-
- defaultListParams = new HashMap<String, String>();
- defaultListParams.put("fields", "*");
- }
}
public void setControllerAddress(final String address) {