summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-07-20 16:52:38 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-07-23 12:13:51 +0100
commit41ecf036b7f1b3bdd56311a0bc706407b242faca (patch)
treef3e1ff4a478888f6adef6e1e847e7bfc639f7b27
parent3d02543fc00a46da2da8f682f71b538ca2fd36e5 (diff)
Fix sonar bugs and vulnerabilities in apex-pdp
Change-Id: I7ecabd3705de4a5352d5a98d1ab3a01677172651 Issue-ID: POLICY-954 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
-rw-r--r--client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameters.java2
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java40
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java38
3 files changed, 46 insertions, 34 deletions
diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameters.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameters.java
index 17f0eac60..ab81d4b05 100644
--- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameters.java
+++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameters.java
@@ -37,7 +37,7 @@ public class ApexServicesRestParameters {
private static final String DEFAULT_STATIC_PATH = "/";
// Package that will field REST requests
- public static final String[] DEFAULT_PACKAGES = new String[] { "org.onap.policy.apex.client.deployment.rest",
+ private static final String[] DEFAULT_PACKAGES = new String[] { "org.onap.policy.apex.client.deployment.rest",
"org.onap.policy.apex.client.editor.rest", "org.onap.policy.apex.client.monitoring.rest" };
// The services parameters
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
index e801ae786..49802c2da 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
@@ -28,9 +28,9 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
@Entity
@@ -59,10 +59,12 @@ public class ArtifactKeyTestEntity extends AxConcept {
this.doubleValue = doubleValue;
}
+ @Override
public AxArtifactKey getKey() {
return key;
}
+ @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
@@ -125,38 +127,42 @@ public class ArtifactKeyTestEntity extends AxConcept {
@Override
public boolean equals(final Object obj) {
- if (obj == null)
+ if (obj == null) {
return false;
- if (this == obj)
+ }
+ if (this == obj) {
return true;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) obj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return false;
- } else if (!key.equals(other.key))
- return false;
- if (doubleValue != other.doubleValue)
+ }
+ } else if (!key.equals(other.key)) {
return false;
- return true;
+ }
+ return (Double.compare(doubleValue, other.doubleValue) == 0);
}
@Override
public int compareTo(final AxConcept otherObj) {
- if (otherObj == null)
+ if (otherObj == null) {
return -1;
- if (this == otherObj)
+ }
+ if (this == otherObj) {
return 0;
+ }
final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return 1;
- } else if (!key.equals(other.key))
+ }
+ } else if (!key.equals(other.key)) {
return key.compareTo(other.key);
- if (doubleValue != other.doubleValue)
- return new Double(doubleValue).compareTo(other.doubleValue);
-
- return 0;
+ }
+ return Double.compare(doubleValue, other.doubleValue);
}
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
index 14c3628e5..6f276335b 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
@@ -62,10 +62,12 @@ public class ReferenceKeyTestEntity extends AxConcept {
this.doubleValue = doubleValue;
}
+ @Override
public AxReferenceKey getKey() {
return key;
}
+ @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
@@ -128,38 +130,42 @@ public class ReferenceKeyTestEntity extends AxConcept {
@Override
public boolean equals(final Object obj) {
- if (obj == null)
+ if (obj == null) {
return false;
- if (this == obj)
+ }
+ if (this == obj) {
return true;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) obj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return false;
- } else if (!key.equals(other.key))
- return false;
- if (doubleValue != other.doubleValue)
+ }
+ } else if (!key.equals(other.key)) {
return false;
- return true;
+ }
+ return (Double.compare(doubleValue, other.doubleValue) == 0);
}
@Override
public int compareTo(final AxConcept otherObj) {
- if (otherObj == null)
+ if (otherObj == null) {
return -1;
- if (this == otherObj)
+ }
+ if (this == otherObj) {
return 0;
+ }
final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return 1;
- } else if (!key.equals(other.key))
+ }
+ } else if (!key.equals(other.key)) {
return key.compareTo(other.key);
- if (doubleValue != other.doubleValue)
- return new Double(doubleValue).compareTo(other.doubleValue);
-
- return 0;
+ }
+ return Double.compare(doubleValue, other.doubleValue);
}
}