archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James William Dumay <ja...@atlassian.com>
Subject Re: svn commit: r718157 - /archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
Date Mon, 17 Nov 2008 03:41:55 GMT
Fixed. Thanks for picking up on this.

On Sun, 2008-11-16 at 20:26 -0700, Joakim Erdfelt wrote:
> You should put that reader.close() in the finally{} block of the try/catch.
> If the MavenXpp3Reader fails, or the FileReader fails on IO read, then 
> the file is still not closed.
> 
> /* typical pattern */
> FileReader reader = null;
> try {
>   reader = new FileReader(file);
>   // Do something with the reader.
> } finally {
>   if(reader != null) {
>     reader.close();
>   }
> }
> 
> - Joakim
> 
> jdumay@apache.org wrote:
> > Author: jdumay
> > Date: Sun Nov 16 17:39:20 2008
> > New Revision: 718157
> >
> > URL: http://svn.apache.org/viewvc?rev=718157&view=rev
> > Log:
> > MRM-1004 - RepositoryServlet tests fail intermittently on Windows. Submitted by
Martin Cooper.
> >
> >
> > Modified:
> >     archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
> >
> > Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
> > URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java?rev=718157&r1=718156&r2=718157&view=diff
> > ==============================================================================
> > --- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
(original)
> > +++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
Sun Nov 16 17:39:20 2008
> > @@ -587,7 +587,11 @@
> >  
> >          try
> >          {
> > -            Model model = new MavenXpp3Reader().read( new FileReader( pom ) );
> > +            // MavenXpp3Reader leaves the file open, so we need to close it ourselves.
> > +            FileReader reader = new FileReader( pom );
> > +            Model model = new MavenXpp3Reader().read( reader );
> > +            reader.close();
> > +
> >              DistributionManagement dist = model.getDistributionManagement();
> >              if ( dist != null )
> >              {
> >
> >
> >   
> 
> 


Mime
View raw message