diff options
author | sharath reddy <bs.reddy@huawei.com> | 2022-03-31 21:45:08 +0530 |
---|---|---|
committer | sharath reddy <bs.reddy@huawei.com> | 2022-03-31 21:45:58 +0530 |
commit | 69495f00d2f559146b43000310b1a6b4d2fa2ab8 (patch) | |
tree | abc9bce21485a63a1aafbaf5bbb2555950f0b44d /framework/src/main/java/org/onap | |
parent | b2aeb4fae1c300d0073b8291e7a5f11bc53d3043 (diff) |
Removed the deprecated usage of readFileToString & writeStringToFile
Issue-ID: CLI-439
report: tested weather-report
Signed-off-by: sharath reddy <bs.reddy@huawei.com>
Change-Id: Ic0cb23c2588341892500fc911eca91b5b695ead5
Diffstat (limited to 'framework/src/main/java/org/onap')
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java index 0d68db1c..ca4c6038 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java @@ -18,6 +18,7 @@ package org.onap.cli.fw.store; import java.io.File; import java.io.IOException; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.security.MessageDigest; @@ -184,7 +185,7 @@ public class OnapCommandArtifactStore { artifact.setCreateAt(dateFormatter.format(new Date())); artifact.setLastUpdatedAt(artifact.getCreateAt()); - FileUtils.writeStringToFile(new File(storePath), gson.toJson(artifact)); + FileUtils.writeStringToFile(new File(storePath), gson.toJson(artifact), (Charset) null); } catch (Exception e) { // NOSONAR //It is expected that this never occurs log.error("Failed to store the artifact at {}", storePath); @@ -201,7 +202,7 @@ public class OnapCommandArtifactStore { } try { - return gson.fromJson(FileUtils.readFileToString(aFile), Artifact.class); + return gson.fromJson(FileUtils.readFileToString(aFile, (Charset) null), Artifact.class); } catch (Exception e) { // NOSONAR //It is expected that this never occurs log.error("Failed to retrieve the artifact at {}", storePath); @@ -317,7 +318,7 @@ public class OnapCommandArtifactStore { artifact.setMetadata(existing.getMetadata()); } - FileUtils.writeStringToFile(new File(newStorePath), gson.toJson(artifact)); + FileUtils.writeStringToFile(new File(newStorePath), gson.toJson(artifact), (Charset) null); if (!newStorePath.equalsIgnoreCase(existingStorePath)) { this.deleteArtifact(name, category); |