From 9ef20cdefa00d8a3c1535c60ddc2a183bff135b2 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 14 Jul 2022 10:27:14 +0100 Subject: Fix error in upgrading instance version Exception thrown when upgrading the version of a component instance in a component composition Signed-off-by: MichaelMorris Issue-ID: SDC-4096 Change-Id: Ice98ab72f9bb69d3fa088a94e4c7c3f903de1f99 --- .../merge/instance/ComponentInstanceInterfacesMerge.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java index 6f5dd03e6d..ecbeb21fea 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java @@ -93,10 +93,10 @@ public class ComponentInstanceInterfacesMerge implements ComponentInstanceMergeI mergeOperationInputDefinitions(oldOperationDef.getInputs(), newOperationDefKeyValue.getInputs(), originalOperationDef.getInputs()); } - if (!originalOperationDef.getImplementation().equals(oldOperationDef.getImplementation())) { + if (originalValueOverwritten(originalOperationDef.getImplementation(), oldOperationDef.getImplementation()) ) { newOperationDefKeyValue.setImplementation(oldOperationDef.getImplementation()); } - if (!originalOperationDef.getDescription().equals(oldOperationDef.getDescription())) { + if (originalValueOverwritten(originalOperationDef.getDescription(), oldOperationDef.getDescription())) { newOperationDefKeyValue.setDescription(oldOperationDef.getDescription()); } newInterfaceDefOperationMap.put(newOperationDefKey, newOperationDefKeyValue); @@ -106,6 +106,13 @@ public class ComponentInstanceInterfacesMerge implements ComponentInstanceMergeI StorageOperationStatus updateStatus = toscaOperationFacade.updateComponentInstanceInterfaces(currentComponent, instanceId); return componentsUtils.convertFromStorageResponse(updateStatus); } + + private boolean originalValueOverwritten(final T originalValue, final T oldValue) { + if (originalValue == null) { + return oldValue != null; + } + return !originalValue.equals(oldValue); + } private void mergeOperationInputDefinitions(ListDataDefinition oldInputs, ListDataDefinition newInputs, -- cgit 1.2.3-korg