archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r1071136 - /archiva/trunk/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
Date Wed, 16 Feb 2011 03:56:27 GMT
I think you still need to close the streams...

On 16/02/2011, at 2:30 PM, oching@apache.org wrote:

> Author: oching
> Date: Wed Feb 16 03:30:53 2011
> New Revision: 1071136
> 
> URL: http://svn.apache.org/viewvc?rev=1071136&view=rev
> Log:
> used IOUtils copy for merging so streams are buffered
> 
> Modified:
>    archiva/trunk/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
> 
> Modified: archiva/trunk/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
> URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java?rev=1071136&r1=1071135&r2=1071136&view=diff
> ==============================================================================
> --- archiva/trunk/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
(original)
> +++ archiva/trunk/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java
Wed Feb 16 03:30:53 2011
> @@ -24,6 +24,7 @@ import org.apache.archiva.metadata.repos
> import org.apache.archiva.metadata.repository.filter.Filter;
> import org.apache.archiva.metadata.repository.filter.IncludesFilter;
> import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
> +import org.apache.commons.io.IOUtils;
> import org.apache.maven.archiva.common.utils.VersionComparator;
> import org.apache.maven.archiva.common.utils.VersionUtil;
> import org.apache.maven.archiva.configuration.ArchivaConfiguration;
> @@ -227,20 +228,8 @@ public class Maven2RepositoryMerger
>         FileOutputStream out = new FileOutputStream( targetFile );
>         FileInputStream input = new FileInputStream( sourceFile );
> 
> -        try
> -        {
> -            int i;
> -            while ( ( i = input.read() ) != -1 )
> -            {
> -                out.write( i );
> -            }
> -            out.flush();
> -        }
> -        finally
> -        {
> -            out.close();
> -            input.close();
> -        }
> +        // IOUtils internally buffers the streams 
> +        IOUtils.copy( input, out );
>     }
> 
>     private void updateProjectMetadata( File projectMetaDataFileIntargetRepo, ArtifactMetadata
artifactMetadata,
> 
> 

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter





Mime
View raw message