diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-06 18:13:17 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-06 18:13:17 +0200 |
commit | 2e4c62864ee5eb926bdf5747c1e592afbbc2d5b8 (patch) | |
tree | c895e234e8ffdf7f31b547ebbe59dfc829cb00c7 /src/main/java/org/onap | |
parent | ecb70d4efc6e1d0d664cf5d8af8b4634be76ba6b (diff) |
Change CsarHandler behavior
Change the Csarhandler so it does not raise an exception when it
installs a file that already exist
Issue-ID: CLAMP-151
Change-Id: I4b260bee95d2651e64bf4318957680918396be4d
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java index 2b83905a8..62169379c 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java @@ -27,9 +27,9 @@ import com.att.aft.dme2.internal.apache.commons.io.IOUtils; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -97,9 +97,9 @@ public class CsarHandler { + artifactElement.getArtifactUUID() + ")"); Path path = Paths.get(csarFilePath); Files.createDirectories(path.getParent()); - Files.createFile(path); - try (FileOutputStream outFile = new FileOutputStream(csarFilePath)) { - outFile.write(resultArtifact.getArtifactPayload(), 0, resultArtifact.getArtifactPayload().length); + // Create or replace the file + try (OutputStream out = Files.newOutputStream(path)) { + out.write(resultArtifact.getArtifactPayload(), 0, resultArtifact.getArtifactPayload().length); } sdcCsarHelper = factory.getSdcCsarHelper(csarFilePath); this.loadDcaeBlueprint(); |