Moving from Plexus Utils IOUtil to Commons IO IOUtils. close(..) becomes closeQuietly(..). copy(..) stays the same. In 1.3 (we're on 1.2 currently) copy(..) will throw an exception if more than MAXINT bytes are copied, but this is just a test case so I think we're safe.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@481460 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2006-12-02 00:37:00 +00:00
parent 08b6a8f7b6
commit 5484a75333
14 changed files with 47 additions and 22 deletions

View File

@ -44,6 +44,10 @@
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

View File

@ -19,7 +19,7 @@ package org.apache.maven.archiva.configuration;
import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Reader; import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Reader;
import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Writer; import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Writer;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@ -112,7 +112,7 @@ public class DefaultConfigurationStore
} }
finally finally
{ {
IOUtil.close( fileReader ); IOUtils.closeQuietly( fileReader );
} }
} }
return configuration; return configuration;
@ -166,7 +166,7 @@ public class DefaultConfigurationStore
} }
finally finally
{ {
IOUtil.close( fileWriter ); IOUtils.closeQuietly( fileWriter );
} }
} }

View File

@ -47,5 +47,9 @@
<artifactId>plexus-i18n</artifactId> <artifactId>plexus-i18n</artifactId>
<version>1.0-beta-6</version> <version>1.0-beta-6</version>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -42,7 +42,7 @@ import org.codehaus.plexus.digest.Digester;
import org.codehaus.plexus.digest.DigesterException; import org.codehaus.plexus.digest.DigesterException;
import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File; import java.io.File;
@ -213,7 +213,7 @@ public class DefaultRepositoryConverter
} }
finally finally
{ {
IOUtil.close( writer ); IOUtils.closeQuietly( writer );
} }
} }
} }
@ -243,7 +243,7 @@ public class DefaultRepositoryConverter
} }
finally finally
{ {
IOUtil.close( fileReader ); IOUtils.closeQuietly( fileReader );
} }
return metadata; return metadata;
} }
@ -515,7 +515,7 @@ public class DefaultRepositoryConverter
} }
finally finally
{ {
IOUtil.close( writer ); IOUtils.closeQuietly( writer );
} }
} }
} }

View File

@ -53,5 +53,9 @@
<version>1.2_Java1.3</version> <version>1.2_Java1.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -42,7 +42,7 @@ import org.codehaus.plexus.digest.DigestUtils;
import org.codehaus.plexus.digest.DigesterException; import org.codehaus.plexus.digest.DigesterException;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File; import java.io.File;
@ -407,7 +407,7 @@ public class DefaultProxyRequestHandler
} }
finally finally
{ {
IOUtil.close( fileReader ); IOUtils.closeQuietly( fileReader );
} }
} }
@ -440,7 +440,7 @@ public class DefaultProxyRequestHandler
} }
finally finally
{ {
IOUtil.close( fileReader ); IOUtils.closeQuietly( fileReader );
} }
if ( changed ) if ( changed )
@ -457,7 +457,7 @@ public class DefaultProxyRequestHandler
} }
finally finally
{ {
IOUtil.close( fileWriter ); IOUtils.closeQuietly( fileWriter );
} }
} }
} }

View File

@ -70,6 +70,10 @@
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

View File

@ -22,7 +22,7 @@ import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor; import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor;
import org.apache.maven.archiva.reporting.database.ReportingDatabase; import org.apache.maven.archiva.reporting.database.ReportingDatabase;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File; import java.io.File;
@ -87,7 +87,7 @@ public class InvalidPomArtifactReportProcessor
} }
finally finally
{ {
IOUtil.close( reader ); IOUtils.closeQuietly( reader );
} }
} }
} }

View File

@ -25,7 +25,7 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor; import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor;
import org.apache.maven.archiva.reporting.database.ReportingDatabase; import org.apache.maven.archiva.reporting.database.ReportingDatabase;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File; import java.io.File;
@ -238,7 +238,7 @@ public class LocationArtifactReportProcessor
} }
finally finally
{ {
IOUtil.close( isReader ); IOUtils.closeQuietly( isReader );
} }
return model; return model;
} }

View File

@ -25,7 +25,7 @@ import org.apache.maven.archiva.reporting.store.ReportingStoreException;
import org.apache.maven.archiva.reporting.database.ReportingDatabase; import org.apache.maven.archiva.reporting.database.ReportingDatabase;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File; import java.io.File;
@ -94,7 +94,7 @@ public class DefaultReportingStore
} }
finally finally
{ {
IOUtil.close( fileReader ); IOUtils.closeQuietly( fileReader );
} }
} }
@ -136,7 +136,7 @@ public class DefaultReportingStore
} }
finally finally
{ {
IOUtil.close( fileWriter ); IOUtils.closeQuietly( fileWriter );
} }
} }
} }

View File

@ -19,7 +19,7 @@ package org.apache.maven.archiva.reporting.reporter;
import org.codehaus.plexus.digest.Digester; import org.codehaus.plexus.digest.Digester;
import org.codehaus.plexus.digest.DigesterException; import org.codehaus.plexus.digest.DigesterException;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import org.apache.maven.archiva.reporting.AbstractRepositoryReportsTestCase; import org.apache.maven.archiva.reporting.AbstractRepositoryReportsTestCase;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@ -136,7 +136,7 @@ public abstract class AbstractChecksumArtifactReporterTestCase
BufferedReader in = new BufferedReader( new FileReader( filename1 ) ); BufferedReader in = new BufferedReader( new FileReader( filename1 ) );
out.putNextEntry( new JarEntry( filename1 ) ); out.putNextEntry( new JarEntry( filename1 ) );
IOUtil.copy( in, out ); IOUtils.copy( in, out );
in.close(); in.close();
out.close(); out.close();

View File

@ -59,5 +59,9 @@
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId> <artifactId>plexus-container-default</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -32,7 +32,7 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil; import org.apache.commons.io.IOUtils;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -268,7 +268,7 @@ public class DefaultRepositoryAssembler
} }
finally finally
{ {
IOUtil.close( writer ); IOUtils.closeQuietly( writer );
} }
try try

View File

@ -346,6 +346,11 @@
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
<version>2.2</version> <version>2.2</version>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.2</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<reporting> <reporting>