summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/service/src/main
diff options
context:
space:
mode:
authorEliezio Oliveira <eliezio.oliveira@est.tech>2019-07-13 19:33:24 +0100
committerEliezio Oliveira <eliezio.oliveira@est.tech>2019-07-13 19:34:58 +0100
commitc15af9a019ae786bc6970fa1184361c1be96693a (patch)
treec81b3f44e19927c1d079a1f911f47710cb4a1856 /ms/controllerblueprints/modules/service/src/main
parent7d58591a2dd41b9e2655f5d06a1eb344146d8e76 (diff)
Fixed bugs/vulnerabilities reported by SonarQube
Change-Id: Idc4be0d050d27fd419915210167b044b90fa2f0a Issue-ID: CCSDK-1483 Signed-off-by: Eliezio Oliveira <eliezio.oliveira@est.tech>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/main')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java
index abf774981..38216a616 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java
@@ -155,19 +155,16 @@ public class SwaggerGenerator {
defProperty = new StringProperty();
}
} else if (BluePrintTypes.validCollectionTypes().contains(propertyDefinition.getType())) {
- ArrayProperty arrayProperty = new ArrayProperty();
+ Optional<Property> innerType = Optional.empty();
if (propertyDefinition.getEntrySchema() != null) {
String entrySchema = propertyDefinition.getEntrySchema().getType();
if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema)) {
- Property innerType = new RefProperty("#/definitions/" + entrySchema);
- arrayProperty.setItems(innerType);
- } else {
- Property innerType = new StringProperty();
- arrayProperty.setItems(innerType);
+ innerType = Optional.of(new RefProperty("#/definitions/" + entrySchema));
}
- defProperty = arrayProperty;
}
-
+ ArrayProperty arrayProperty = new ArrayProperty();
+ arrayProperty.setItems(innerType.orElseGet(StringProperty::new));
+ defProperty = arrayProperty;
} else {
defProperty = new RefProperty("#/definitions/" + propertyDefinition.getType());
}