]> source.dussan.org Git - archiva.git/commitdiff
[MRM-709] Use commons-io instead of Plexus Utils
authorJoakim Erdfelt <joakime@apache.org>
Fri, 14 Mar 2008 05:01:56 +0000 (05:01 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Fri, 14 Mar 2008 05:01:56 +0000 (05:01 +0000)
* Some more IOUtil and FileUtil conversions.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@636993 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeRecordLoader.java
archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java
archiva-base/archiva-transaction/pom.xml
archiva-base/archiva-transaction/src/main/java/org/apache/maven/archiva/transaction/AbstractTransactionEvent.java
archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/AbstractFileEventTest.java

index 4b9ed12f08fad3b8f00a46e72cd26318c64df18b..9795215e135325facdb6e900fed1db708165babe 100644 (file)
@@ -9,7 +9,7 @@ package org.apache.maven.archiva.indexer.bytecode;
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -20,10 +20,11 @@ package org.apache.maven.archiva.indexer.bytecode;
  */
 
 import junit.framework.AssertionFailedError;
+
+import org.apache.commons.io.IOUtils;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaArtifactJavaDetails;
 import org.apache.maven.archiva.model.platform.JavaArtifactHelper;
-import org.codehaus.plexus.util.IOUtil;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -125,8 +126,8 @@ public class BytecodeRecordLoader
         }
         finally
         {
-            IOUtil.close( reader );
-            IOUtil.close( freader );
+            IOUtils.closeQuietly( reader );
+            IOUtils.closeQuietly( freader );
         }
 
 //        cache.put( artifact, record );
index b033569040d931ffab0f7da4f5542074ecc75557..4d9e0f74d41b16a1c615589da59b515ea4d0b9c5 100644 (file)
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.indexer.hashcodes;
  * under the License.
  */
 
+import org.apache.commons.io.IOUtils;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaArtifactJavaDetails;
 import org.apache.maven.archiva.model.platform.JavaArtifactHelper;
-import org.codehaus.plexus.util.IOUtil;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -97,8 +97,8 @@ public class HashcodesRecordLoader
         }
         finally
         {
-            IOUtil.close( reader );
-            IOUtil.close( freader );
+            IOUtils.closeQuietly( reader );
+            IOUtils.closeQuietly( freader );
         }
 
         return record;
index 754eb5726d1f70028955282a7936908b07d7a818..88a3e2af79177517ff424aef373741dd29de1076 100644 (file)
   <name>Archiva Transactions</name>
   <description>API for managing transaction.</description>
   <dependencies>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-digest</artifactId>
index b8e08f0ebaec745370d1ee206743015dfdb5ea9c..7323f7cfd412ac7e5a8997319782434ec0eed0c2 100644 (file)
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.transaction;
  * under the License.
  */
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
 import org.codehaus.plexus.digest.Digester;
 import org.codehaus.plexus.digest.DigesterException;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -215,19 +215,13 @@ public abstract class AbstractTransactionEvent
         }
     }
 
+    /**
+     * TODO: Remove in favor of using FileUtils directly.
+     */
     protected void writeStringToFile( File file, String content )
         throws IOException
     {
-        FileOutputStream out = null;
-        try
-        {
-            out = new FileOutputStream( file );
-            IOUtil.copy( content, out );
-        }
-        finally
-        {
-            IOUtil.close( out );
-        }
+        FileUtils.writeStringToFile( file, content );
     }
 
     /**
index d30d83917d696029a0ea91c5199c448c0534c919..05652f554cdf0bf85734987ae0f4ce653f807e13 100644 (file)
@@ -19,9 +19,9 @@ package org.apache.maven.archiva.transaction;
  * under the License.
  */
 
+import org.apache.commons.io.IOUtils;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.digest.Digester;
-import org.codehaus.plexus.util.IOUtil;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -85,7 +85,7 @@ public abstract class AbstractFileEventTest
         try
         {
             in = new FileInputStream( file );
-            return IOUtil.toString( in );
+            return IOUtils.toString( in );
         }
         finally
         {