CLAMP should not display all CDS workflow properties
[clamp.git] / src / main / java / org / onap / clamp / clds / util / ResourceFileUtil.java
index 0402754..5deee46 100644 (file)
@@ -18,7 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END============================================
  * ===================================================================
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * 
  */
 
 package org.onap.clamp.clds.util;
@@ -55,13 +55,11 @@ public final class ResourceFileUtil {
      * Return resource as a String.
      */
     public static String getResourceAsString(String name) throws IOException {
-        InputStream is = getResourceAsStream(name);
-        Scanner scanner = new Scanner(is);
-        Scanner delimitedScanner = scanner.useDelimiter("\\A");
-        String text = delimitedScanner.hasNext() ? delimitedScanner.next() : "";
-        delimitedScanner.close();
-        scanner.close();
-        is.close();
-        return text;
+        try (InputStream is = getResourceAsStream(name)) {
+            try (Scanner scanner = new Scanner(is)) {
+                Scanner delimitedScanner = scanner.useDelimiter("\\A");
+                return delimitedScanner.hasNext() ? delimitedScanner.next() : "";
+            }
+        }
     }
 }