avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosu...@apache.org
Subject cvs commit: jakarta-avalon/src/java/org/apache/avalon/framework/configuration DefaultConfigurationSerializer.java
Date Wed, 24 Jul 2002 15:50:18 GMT
leosutic    2002/07/24 08:50:18

  Modified:    src/java/org/apache/avalon/framework/configuration
                        DefaultConfigurationSerializer.java
  Log:
  Fixed the serializer to close the output stream in serializeToFile and serialize( String
uri, ... )
  
  Revision  Changes    Path
  1.15      +26 -2     jakarta-avalon/src/java/org/apache/avalon/framework/configuration/DefaultConfigurationSerializer.java
  
  Index: DefaultConfigurationSerializer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration/DefaultConfigurationSerializer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultConfigurationSerializer.java	13 Jul 2002 19:19:20 -0000	1.14
  +++ DefaultConfigurationSerializer.java	24 Jul 2002 15:50:18 -0000	1.15
  @@ -236,7 +236,19 @@
       public void serializeToFile( final File file, final Configuration source )
           throws SAXException, IOException, ConfigurationException
       {
  -        serialize( new FileOutputStream( file ), source );
  +        OutputStream outputStream = null;
  +        try 
  +        {
  +            outputStream = new FileOutputStream( file );
  +            serialize( outputStream, source );
  +        } 
  +        finally 
  +        {
  +            if( outputStream != null )
  +            {
  +                outputStream.close();
  +            }
  +        }
       }
   
       /**
  @@ -265,6 +277,18 @@
       public void serialize( final String uri, final Configuration source )
           throws SAXException, IOException, ConfigurationException
       {
  -        serialize( new URL( uri ).openConnection().getOutputStream(), source );
  +        OutputStream outputStream = null;
  +        try 
  +        {
  +            outputStream = new URL( uri ).openConnection().getOutputStream();
  +            serialize( outputStream, source );
  +        } 
  +        finally
  +        {
  +            if( outputStream != null )
  +            {
  +                outputStream.close();
  +            }
  +        }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message