re base code
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / jsontitan / utils / InterfaceUtils.java
index 49f1694..a350d7e 100644 (file)
  */
 package org.openecomp.sdc.be.model.jsontitan.utils;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Formatter;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.openecomp.sdc.be.datatypes.elements.InputDataDefinition;
@@ -35,6 +26,9 @@ import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.Operation;
 import org.openecomp.sdc.be.model.Resource;
 
+import java.util.*;
+import java.util.stream.Collectors;
+
 public class InterfaceUtils {
 
     public static final String INTERFACE_TOSCA_RESOURCE_NAME = "org.openecomp.interfaces.node.lifecycle.%s";
@@ -66,8 +60,9 @@ public class InterfaceUtils {
 
     public static String createInterfaceToscaResourceName(String resourceName) {
         StringBuilder sb = new StringBuilder();
-        Formatter formatter = new Formatter(sb);
-        return formatter.format(INTERFACE_TOSCA_RESOURCE_NAME, resourceName).toString();
+        try (Formatter formatter = new Formatter(sb)){
+            return formatter.format(INTERFACE_TOSCA_RESOURCE_NAME, resourceName).toString();
+        }
     }
 
     public static Map<String, Operation> getInterfaceOperationsFromInterfaces(