Closing artifact files after vtl templating 85/128585/1
authorLukasz Rajewski <lukasz.rajewski@orange.com>
Wed, 13 Apr 2022 18:49:52 +0000 (20:49 +0200)
committerLukasz Rajewski <lukasz.rajewski@orange.com>
Wed, 13 Apr 2022 18:49:52 +0000 (20:49 +0200)
Issue-ID: CCSDK-3631
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: I20972afeebafbc0ea47ee22c2ba9b32d760ebbb5

ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt
ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt

index 80e1cb4..e7d781d 100644 (file)
@@ -372,7 +372,7 @@ open class K8sProfileUploadComponent(
         )
         if (!isFileInTheManifestFiles(finalFile, manifestFiles))
             return
-        val fileContent = templatedFile.bufferedReader().readText()
+        val fileContent = Files.readString(templatedFile.toPath())
         val finalFileContent = BluePrintVelocityTemplateService.generateContent(
             fileContent,
             params.toString(), true
index cd58baf..591b3de 100644 (file)
@@ -259,7 +259,7 @@ open class K8sConfigTemplateComponent(
 
     private fun templateFile(templateFile: File, params: JsonNode, destinationFolder: File) {
         val finalFile = File(destinationFolder.path.plus(File.separator).plus(templateFile.nameWithoutExtension))
-        val fileContent = templateFile.bufferedReader().readText()
+        val fileContent = Files.readString(templateFile.toPath())
         val finalFileContent = BluePrintVelocityTemplateService.generateContent(
             fileContent,
             params.toString(), true
index 0b62949..90f59c4 100644 (file)
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory
 import org.springframework.context.annotation.Scope
 import org.springframework.stereotype.Component
 import java.io.File
+import java.nio.file.Files
 import java.nio.file.Path
 import java.nio.file.Paths
 
@@ -252,7 +253,7 @@ open class K8sConfigValueComponent(
     }
 
     private fun templateValues(templateFile: File, params: JsonNode): String {
-        val fileContent = templateFile.bufferedReader().readText()
+        val fileContent = Files.readString(templateFile.toPath())
         return BluePrintVelocityTemplateService.generateContent(
             fileContent,
             params.toString(), true