fix PCE vulnerabilities identified in sonar 20/83520/1
authorguillaume.lambert <guillaume.lambert@orange.com>
Thu, 8 Aug 2019 09:44:34 +0000 (11:44 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Thu, 8 Aug 2019 09:47:20 +0000 (11:47 +0200)
PceConstraints ResourcePair parameters declared as public
instead of private + accessors

Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I742bed7656ea3a4d368cad437f0ddc082d6964d8

pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraints.java
pce/src/main/java/org/opendaylight/transportpce/pce/graph/InAlgoPathValidator.java

index b5e8c7978ce4167d786089120296e5b353f41249..5b79cb9a9fef98f8315ef079deaf710d162e507c 100644 (file)
@@ -171,9 +171,18 @@ public class PceConstraints {
             this.name = name;
         }
 
-        public ResourceType type = ResourceType.NODE;
+        private ResourceType type = ResourceType.NODE;
+
+        private String name = "";
+
+        public ResourceType getType() {
+            return type;
+        }
+
+        public String getName() {
+            return name;
+        }
 
-        public String name = "";
     }
 
     public List<ResourcePair> getListToInclude() {
index 19f6049d12d26765f4b566756835617247fe39e3..2ce1f62a46c241118ed7679daebc58c08c65ea83 100644 (file)
@@ -155,32 +155,32 @@ public class InAlgoPathValidator implements PathValidator<String, PceGraphEdge>
         // validation: check each type for each element
         for (ResourcePair next : listToInclude) {
             int indx = -1;
-            switch (next.type) {
+            switch (next.getType()) {
                 case NODE:
-                    if (listOfElementsSubNode.contains(next.name)) {
-                        indx = listOfElementsSubNode.indexOf(next.name);
+                    if (listOfElementsSubNode.contains(next.getName())) {
+                        indx = listOfElementsSubNode.indexOf(next.getName());
                     }
                     break;
                 case SRLG:
-                    if (listOfElementsSRLG.contains(next.name)) {
-                        indx = listOfElementsSRLG.indexOf(next.name);
+                    if (listOfElementsSRLG.contains(next.getName())) {
+                        indx = listOfElementsSRLG.indexOf(next.getName());
                     }
                     break;
                 case CLLI:
-                    if (listOfElementsCLLI.contains(next.name)) {
-                        indx = listOfElementsCLLI.indexOf(next.name);
+                    if (listOfElementsCLLI.contains(next.getName())) {
+                        indx = listOfElementsCLLI.indexOf(next.getName());
                     }
                     break;
                 default:
-                    LOG.warn(" in checkInclude vertex list unsupported resource type: [{}]", next.type);
+                    LOG.warn(" in checkInclude vertex list unsupported resource type: [{}]", next.getType());
             }
 
             if (indx < 0) {
-                LOG.debug(" in checkInclude stopped : {} ", next.name);
+                LOG.debug(" in checkInclude stopped : {} ", next.getName());
                 return false;
             }
 
-            LOG.debug(" in checkInclude next found {} in {}", next.name, partialPath.getVertexList());
+            LOG.debug(" in checkInclude next found {} in {}", next.getName(), partialPath.getVertexList());
 
             listOfElementsSubNode.subList(0, indx).clear();
             listOfElementsCLLI.subList(0, indx).clear();