From 396cb378ab8940b1adb8ba1adc656d0b4ad66f99 Mon Sep 17 00:00:00 2001 From: Divesh Mirchandani Date: Thu, 14 Sep 2017 19:14:21 +0530 Subject: Fixed SONAR issues Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 --- .../generator/datatypes/tosca/ComputeFlavor.java | 24 +++++---- .../datatypes/tosca/DeploymentFlavorModel.java | 36 +++++++------ .../generator/datatypes/tosca/LicenseFlavor.java | 12 +++-- .../datatypes/tosca/MultiFlavorVfcImage.java | 36 +++++++------ .../sdc/generator/datatypes/tosca/VendorInfo.java | 20 +++---- .../generator/datatypes/tosca/VspModelInfo.java | 62 +++++++++++----------- 6 files changed, 101 insertions(+), 89 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api') diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java index d888bd311b..e34627d62b 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java @@ -41,21 +41,23 @@ public class ComputeFlavor { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; ComputeFlavor other = (ComputeFlavor) obj; - if (num_cpus != other.num_cpus) - return false; - if (this.disk_size == null) { - if (other.disk_size != null) + if(other != null) { + if (num_cpus != other.num_cpus) return false; - } else if (!disk_size.equals(other.disk_size)) - return false; - if (this.mem_size == null) { - if (other.mem_size != null) + if (this.disk_size == null) { + if (other.disk_size != null) + return false; + } else if (!disk_size.equals(other.disk_size)) return false; - } else if (!mem_size.equals(other.mem_size)) - return false; + if (this.mem_size == null) { + if (other.mem_size != null) + return false; + } else if (!mem_size.equals(other.mem_size)) + return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java index a0d5f40b8c..3bc338361e 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java @@ -53,29 +53,31 @@ public class DeploymentFlavorModel { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; DeploymentFlavorModel other = (DeploymentFlavorModel) obj; - if (this.sp_part_number == null) { - if (other.sp_part_number != null) + if (other != null) { + if (this.sp_part_number == null) { + if (other.sp_part_number != null) + return false; + } else if (!sp_part_number.equals(other.sp_part_number)) return false; - } else if (!sp_part_number.equals(other.sp_part_number)) - return false; - if (this.vendor_info == null) { - if (other.vendor_info != null) + if (this.vendor_info == null) { + if (other.vendor_info != null) + return false; + } else if (!vendor_info.equals(other.vendor_info)) return false; - } else if (!vendor_info.equals(other.vendor_info)) - return false; - if (this.compute_flavor == null) { - if (other.compute_flavor != null) + if (this.compute_flavor == null) { + if (other.compute_flavor != null) + return false; + } else if (!compute_flavor.equals(other.compute_flavor)) return false; - } else if (!compute_flavor.equals(other.compute_flavor)) - return false; - if (this.license_flavor == null) { - if (other.license_flavor != null) + if (this.license_flavor == null) { + if (other.license_flavor != null) + return false; + } else if (!license_flavor.equals(other.license_flavor)) return false; - } else if (!license_flavor.equals(other.license_flavor)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java index f459d9e993..1cdeaca562 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java @@ -24,14 +24,16 @@ public class LicenseFlavor { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; LicenseFlavor other = (LicenseFlavor) obj; - if (this.feature_group_uuid == null) { - if (other.feature_group_uuid != null) + if (other != null) { + if (this.feature_group_uuid == null) { + if (other.feature_group_uuid != null) + return false; + } else if (!feature_group_uuid.equals(other.feature_group_uuid)) return false; - } else if (!feature_group_uuid.equals(other.feature_group_uuid)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java index 6cd713e2d1..560a7765f2 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java @@ -54,29 +54,31 @@ public class MultiFlavorVfcImage { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; MultiFlavorVfcImage other = (MultiFlavorVfcImage) obj; - if (this.file_name == null) { - if (other.file_name != null) + if (other != null) { + if (this.file_name == null) { + if (other.file_name != null) + return false; + } else if (!file_name.equals(other.file_name)) return false; - } else if (!file_name.equals(other.file_name)) - return false; - if (this.file_hash == null) { - if (other.file_hash != null) + if (this.file_hash == null) { + if (other.file_hash != null) + return false; + } else if (!file_hash.equals(other.file_hash)) return false; - } else if (!file_hash.equals(other.file_hash)) - return false; - if (this.file_hash_type == null) { - if (other.file_hash_type != null) + if (this.file_hash_type == null) { + if (other.file_hash_type != null) + return false; + } else if (!file_hash_type.equals(other.file_hash_type)) return false; - } else if (!file_hash_type.equals(other.file_hash_type)) - return false; - if (this.software_version == null) { - if (other.software_version != null) + if (this.software_version == null) { + if (other.software_version != null) + return false; + } else if (!software_version.equals(other.software_version)) return false; - } else if (!software_version.equals(other.software_version)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java index 22348f3083..0c2be2508c 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java @@ -32,19 +32,21 @@ public class VendorInfo { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; VendorInfo other = (VendorInfo) obj; - if (this.manufacturer_reference_number == null) { - if (other.manufacturer_reference_number != null) + if (other != null) { + if (this.manufacturer_reference_number == null) { + if (other.manufacturer_reference_number != null) + return false; + } else if (!manufacturer_reference_number.equals(other.manufacturer_reference_number)) return false; - } else if (!manufacturer_reference_number.equals(other.manufacturer_reference_number)) - return false; - if (this.vendor_model == null) { - if (other.vendor_model != null) + if (this.vendor_model == null) { + if (other.vendor_model != null) + return false; + } else if (!vendor_model.equals(other.vendor_model)) return false; - } else if (!vendor_model.equals(other.vendor_model)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java index 025db1cafc..4372e7f98a 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java @@ -82,51 +82,53 @@ public class VspModelInfo { if (this == obj) { return true; } - if (getClass() != obj.getClass()) { + if (obj != null && getClass() != obj.getClass()) { return false; } VspModelInfo other = (VspModelInfo) obj; - if (this.releaseVendor == null) { - if (other.releaseVendor != null) { + if(other != null) { + if (this.releaseVendor == null) { + if (other.releaseVendor != null) { + return false; + } + } else if (!releaseVendor.equals(other.releaseVendor)) { return false; } - } else if (!releaseVendor.equals(other.releaseVendor)) { - return false; - } - if (this.components == null) { - if (other.components != null) { + if (this.components == null) { + if (other.components != null) { + return false; + } + } else if (!components.equals(other.components)) { return false; } - } else if (!components.equals(other.components)) { - return false; - } - if (this.allowedFlavors == null) { - if (other.allowedFlavors != null) { + if (this.allowedFlavors == null) { + if (other.allowedFlavors != null) { + return false; + } + } else if (!allowedFlavors.equals(other.allowedFlavors)) { return false; } - } else if (!allowedFlavors.equals(other.allowedFlavors)) { - return false; - } - if (this.multiFlavorVfcImages == null) { - if (other.multiFlavorVfcImages != null) { + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { return false; } - } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { - return false; - } - if (this.multiFlavorVfcImages == null) { - if (other.multiFlavorVfcImages != null) { + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { return false; } - } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { - return false; - } - if (this.nics == null) { - if (other.nics != null) { + if (this.nics == null) { + if (other.nics != null) { + return false; + } + } else if (!nics.equals(other.nics)) { return false; } - } else if (!nics.equals(other.nics)) { - return false; } return true; } -- cgit 1.2.3-korg