aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-layer
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-04-16 18:11:38 +1000
committerOlivier Lamy <olamy@apache.org>2014-04-16 18:11:38 +1000
commitec1e655c9d996f20bd231b21505a6df865d8a1f7 (patch)
tree83a6e56ba6b0e2a0f9e0bd97c2ddd1b05b5d90aa /archiva-modules/archiva-base/archiva-repository-layer
parent767e00c182085b193c9f2481a815e90c5c054095 (diff)
downloadarchiva-ec1e655c9d996f20bd231b21505a6df865d8a1f7.tar.gz
archiva-ec1e655c9d996f20bd231b21505a6df865d8a1f7.zip
use Files.copy from java.nio.file
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-layer')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java
index ab47e78c1..0eb06b225 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java
@@ -25,7 +25,6 @@ import org.apache.archiva.xml.XMLException;
import org.apache.archiva.xml.XMLWriter;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
@@ -35,6 +34,7 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
+import java.nio.file.Files;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
@@ -49,10 +49,8 @@ public class RepositoryMetadataWriter
throws RepositoryMetadataException
{
boolean thrown = false;
- FileWriter writer = null;
- try
+ try (FileWriter writer = new FileWriter( outputFile ))
{
- writer = new FileWriter( outputFile );
write( metadata, writer );
writer.flush();
}
@@ -64,7 +62,6 @@ public class RepositoryMetadataWriter
}
finally
{
- IOUtils.closeQuietly( writer );
if ( thrown )
{
FileUtils.deleteQuietly( outputFile );