diff options
Diffstat (limited to 'test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java')
-rw-r--r-- | test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java index 65ab6c920a..8d39bd1c99 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AutomationUtils.java @@ -20,15 +20,15 @@ package org.openecomp.sdc.ci.tests.utils.rest; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.Utils; + import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; - public class AutomationUtils extends BaseRestUtils { @@ -63,24 +63,24 @@ public class AutomationUtils extends BaseRestUtils { public static void createVersionsInfoFile(String filepath, String onboardVersion, String osVersion, String envData, String suiteName) throws IOException { File myFoo = new File(filepath); - FileOutputStream fooStream = new FileOutputStream(myFoo, false); // true to append - String versions = ("onboardVersion=\""+ onboardVersion+ "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\""+ envData + "\"\n" + "suiteName=\""+ suiteName+ "\"\n"); - byte[] myBytes = versions.getBytes(); - fooStream.write(myBytes); - fooStream.close(); + try (FileOutputStream fooStream = new FileOutputStream(myFoo, false)) { + String versions = ("onboardVersion=\"" + onboardVersion + "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n"); + byte[] myBytes = versions.getBytes(); + fooStream.write(myBytes); + } } public static void createVersionsInfoFile(String filepath, String onboardVersion, String osVersion, String envData, String suiteName, String reportStartTime) throws IOException { File myFoo = new File(filepath); - FileOutputStream fooStream = new FileOutputStream(myFoo, false); // true to append - String versions = ("onboardVersion=\""+ onboardVersion+ "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\""+ envData + "\"\n" + "suiteName=\""+ suiteName+ "\"\n" + "reportStartTime=\""+ reportStartTime+ "\"\n"); - byte[] myBytes = versions.getBytes(); - fooStream.write(myBytes); - fooStream.close(); + try (FileOutputStream fooStream = new FileOutputStream(myFoo, false)) { + String versions = ("onboardVersion=\"" + onboardVersion + "\"\n" + "osVersion=\"" + osVersion + "\"\n" + "env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n" + "reportStartTime=\"" + reportStartTime + "\"\n"); + byte[] myBytes = versions.getBytes(); + fooStream.write(myBytes); + } } public static void createVersionsInfoFile(String filepath, String onboardVersion, String osVersion, String envData) - throws FileNotFoundException, IOException { + throws IOException { createVersionsInfoFile(filepath, onboardVersion, osVersion, envData, null); } |