diff options
author | Olivier Lamy <olamy@apache.org> | 2015-03-23 14:57:49 +1100 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2015-03-23 14:57:49 +1100 |
commit | a6c73dcde2a11d763a576edff292f9361a2fdb16 (patch) | |
tree | e37a4a3357a6c45d288dc6d8941551c66b39a09c /archiva-modules/archiva-base/archiva-checksum/src | |
parent | 81411e352d6dcbc2b82a762170fefc6608cd195a (diff) | |
download | archiva-a6c73dcde2a11d763a576edff292f9361a2fdb16.tar.gz archiva-a6c73dcde2a11d763a576edff292f9361a2fdb16.zip |
use more java 1.7 for file io
Diffstat (limited to 'archiva-modules/archiva-base/archiva-checksum/src')
-rw-r--r-- | archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java b/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java index 2cd0169f0..0f36ce1c1 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java @@ -28,6 +28,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -95,8 +96,10 @@ public class ChecksummedFile throws IOException { File checksumFile = new File( referenceFile.getAbsolutePath() + "." + checksumAlgorithm.getExt() ); + Files.deleteIfExists( checksumFile.toPath() ); String checksum = calculateChecksum( checksumAlgorithm ); - FileUtils.writeStringToFile( checksumFile, checksum + " " + referenceFile.getName() ); + Files.write( checksumFile.toPath(), (checksum + " " + referenceFile.getName()).getBytes(), StandardOpenOption.CREATE_NEW ); + //FileUtils.writeStringToFile( checksumFile, checksum + " " + referenceFile.getName() ); return checksumFile; } |