fix a POL500 issue 23/78723/4
authorLiang Ding <liang.ding@intel.com>
Tue, 19 Feb 2019 02:54:04 +0000 (18:54 -0800)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Sun, 24 Feb 2019 09:19:43 +0000 (09:19 +0000)
when creating a VSPfrom a tosca VNF, a POL500 was reported

Change-Id: I8d942b81689f35cdeb16aa4b0925371394bb639c
Issue-ID: SDC-1983
Signed-off-by: Liang Ding <liang.ding@intel.com>
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java

index efbaaa6..82f7c32 100644 (file)
@@ -5106,11 +5106,15 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
             actualVfName = vfResourceName;
             actualType = nodeResourceType;
         }
-
+        String nameWithouNamespacePrefix;
         try {
             StringBuilder toscaResourceName = new StringBuilder(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX);
-            String nameWithouNamespacePrefix = nodeTypeFullName
+            if (!nodeTypeFullName.contains(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX)){
+               nameWithouNamespacePrefix = nodeTypeFullName;
+            } else {
+                nameWithouNamespacePrefix = nodeTypeFullName
                     .substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
+            }
             String[] findTypes = nameWithouNamespacePrefix.split("\\.");
             String resourceType = findTypes[0];
             String actualName = nameWithouNamespacePrefix.substring(resourceType.length());
@@ -5181,4 +5185,4 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
             return super.shouldUpgradeToLatestDerived(clonedComponent);
         }
     }
-}
\ No newline at end of file
+}