aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/websocketmanager/provider
diff options
context:
space:
mode:
authorhighstreetherbert <herbert.eiselt@highstreet-technologies.com>2021-11-19 18:22:06 +0100
committerKAPIL SINGAL <ks220y@att.com>2021-11-27 17:24:42 +0000
commit403892147e940c0d1a23f964265d078385eb92e2 (patch)
tree48ba25296e11060e72682576ac3b873c4063cb21 /sdnr/wt/websocketmanager/provider
parent3e739d832853e821472facb181aa972ecfb45b1c (diff)
Synchronize sdnr/wt data-provider, websocketmanager, netconfstate-provider
Synchronize sdnr/wt artifacts Issue-ID: CCSDK-3530 Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com> Change-Id: I6e6c25a03e12acf0bd666675aaeb5a8518ed7b1e Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/websocketmanager/provider')
-rw-r--r--sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java3
-rw-r--r--sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java9
2 files changed, 8 insertions, 4 deletions
diff --git a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java
index 7cc6d7272..95715be39 100644
--- a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java
+++ b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java
@@ -18,6 +18,7 @@
package org.onap.ccsdk.features.sdnr.wt.websocketmanager;
import com.fasterxml.jackson.core.JsonProcessingException;
+import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -59,7 +60,7 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
private static final String REGEX_SCOPEREGISTRATION = "\"data\"[\\s]*:[\\s]*\"scopes\"";
private static final Pattern PATTERN_SCOPEREGISTRATION =
Pattern.compile(REGEX_SCOPEREGISTRATION, Pattern.MULTILINE);
- private static final Random RND = new Random();
+ private static final SecureRandom RND = new SecureRandom();
private static final long SEND_MESSAGE_TIMEOUT_MILLIS = 1500;
private static final int QUEUE_SIZE = 100;
diff --git a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java
index 794515bb2..7bbbfea6d 100644
--- a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java
+++ b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java
@@ -49,7 +49,7 @@ public class AkkaConfig {
}
public ClusterNodeInfo(String s) throws Exception {
- final String regex = "([a-z.]*):\\/\\/([a-zA-Z0-9-]*)@([a-zA-Z0-9.-]*):([0-9]*)";
+ final String regex = "([a-z.]{0,10}):\\/\\/([a-zA-Z0-9-]{0,1024})@([a-zA-Z0-9.-]{0,1024}):([0-9]{0,10})";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
@@ -71,7 +71,10 @@ public class AkkaConfig {
private final int Index;
public ClusterRoleInfo(String s) throws Exception {
- final String regex = "([a-z]*)-([0-9]*)";
+ // role with minimum 1 character
+ // index with minimum 1 character or Integer.parseInt raise an exception
+ // index with maximum 10 because it's an integer
+ final String regex = "([a-z]{1,1024})-([0-9]{1,10})";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
@@ -177,7 +180,7 @@ public class AkkaConfig {
}
public boolean isCluster() {
- return this.cluserConfig != null ? this.cluserConfig.isCluster() : false;
+ return this.cluserConfig != null && this.cluserConfig.isCluster();
}
public static AkkaConfig load() throws Exception {