diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-06-17 11:51:42 +0200 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-06-18 11:38:57 +0200 |
commit | 095c81fe69ca0c54cd7923888fa9bf4f7924b369 (patch) | |
tree | 57f399ed10b0a4ab63dd15bf893f027e14f4a686 /bpmn/so-bpmn-tasks/src/main/java/org | |
parent | 984f8da49f06c1563b4496572c54147014aa94bb (diff) |
Fixed critical Sonar bugs
Fixed critical bugs according to the Sonar analysis.
-Fixed possible NPE.
-Fixed wrong comparison.
-Removed unused variables.
Issue-ID: SO-2025
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Change-Id: I5e2e5413c8421eb7ed1db21de6d888a50e1db689
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index b0ba0595d5..a1fcbff0db 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +35,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.PostConstruct; -import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang3.StringUtils; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; @@ -118,7 +119,7 @@ public class VnfAdapterVfModuleObjectMapper { public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) - throws JsonParseException, JsonMappingException, IOException { + throws IOException { CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); @@ -167,7 +168,7 @@ public class VnfAdapterVfModuleObjectMapper { private Map<String, Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) - throws JsonParseException, JsonMappingException, IOException { + throws IOException { GenericResourceApiVnfTopology vnfTop = @@ -206,7 +207,7 @@ public class VnfAdapterVfModuleObjectMapper { Map<String, Object> srcMap) { StringBuilder directives = new StringBuilder(); int no_directives_size = 0; - if (directives.equals(MsoMulticloudUtils.USER_DIRECTIVES) + if (directive.equals(MsoMulticloudUtils.USER_DIRECTIVES) && srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) { no_directives_size = 1; } @@ -214,7 +215,7 @@ public class VnfAdapterVfModuleObjectMapper { directives.append("{ \"attributes\": [ "); int i = 0; for (String attributeName : srcMap.keySet()) { - if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directives) + if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directive) && attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) { directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString())); if (i < (srcMap.size() - 1 + no_directives_size)) @@ -247,7 +248,7 @@ public class VnfAdapterVfModuleObjectMapper { private void buildParamsMapFromVnfSdncResponse(Map<String, Object> paramsMap, GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String, String> networkRoleMap, - boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException { + boolean skipVnfResourceAssignments) throws IOException { // Get VNF parameters from SDNC response GenericResourceApiParam vnfParametersData = vnfTopology.getVnfParametersData(); buildParamsMapFromSdncParams(paramsMap, vnfParametersData); @@ -324,7 +325,7 @@ public class VnfAdapterVfModuleObjectMapper { private void buildParamsMapFromVfModuleSdncResponse(Map<String, Object> paramsMap, GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments) - throws JsonParseException, JsonMappingException, IOException { + throws IOException { // Get VF Module parameters from SDNC response GenericResourceApiParam vfModuleParametersData = vfModuleTopology.getVfModuleParameters(); buildParamsMapFromSdncParams(paramsMap, vfModuleParametersData); |