summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-04-17 14:17:32 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-17 14:17:32 +0000
commit69fe07924436e07a4fb21ac39714f11397cf41b3 (patch)
treec02fc5129ff1c698b1e52e7d18025be959454287 /model
parentaa57cf2db2710247b57e1bdd989777258a292150 (diff)
parenteb06c3532c133a9126bd45c5485087edf5e3ad54 (diff)
Merge "Fix sonar issues"
Diffstat (limited to 'model')
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
index a60c609e2..35010bf4b 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
@@ -37,6 +37,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.commons.lang3.StringUtils;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner;
import org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String;
@@ -64,6 +65,8 @@ public class AxKeyInfo extends AxConcept {
private static final int MAX_DESCRIPTION_LENGTH_8192 = 8192;
private static final int UUID_BYTE_LENGTH_16 = 16;
+ private static final Random sharedRandom = new Random();
+
@EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
@@ -331,11 +334,9 @@ public class AxKeyInfo extends AxConcept {
* @return the uuid
*/
public static UUID generateReproducibleUuid(final String seed) {
- final Random random;
- if (seed != null && seed.length() > 0) {
+ Random random = sharedRandom;
+ if (!StringUtils.isEmpty(seed)) {
random = new Random(seed.hashCode());
- } else {
- random = new Random();
}
final byte[] array = new byte[UUID_BYTE_LENGTH_16];
random.nextBytes(array);