aboutsummaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
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);