portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jf...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager CastorPsmlManagerService.java
Date Wed, 31 Mar 2004 00:23:02 GMT
jford       2004/03/30 16:23:02

  Modified:    src/java/org/apache/jetspeed/services/registry
                        CastorRegistryService.java
               src/java/org/apache/jetspeed/services/psmlmanager
                        CastorPsmlManagerService.java
  Log:
  Fixed issue with output streams not being closed properly
  
  Revision  Changes    Path
  1.37      +13 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/CastorRegistryService.java
  
  Index: CastorRegistryService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/CastorRegistryService.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- CastorRegistryService.java	23 Mar 2004 21:05:40 -0000	1.36
  +++ CastorRegistryService.java	31 Mar 2004 00:23:02 -0000	1.37
  @@ -629,6 +629,7 @@
       public void saveFragment(String file)
       {
           OutputStreamWriter writer = null;
  +        FileOutputStream fos = null;
           String encoding = new String("UTF-8");
           RegistryFragment fragment = (RegistryFragment) fragments.get(file);
   
  @@ -636,7 +637,8 @@
           {
               try
               {
  -                writer = new OutputStreamWriter(new FileOutputStream(file), encoding);
  +            	fos = new FileOutputStream(file);
  +                writer = new OutputStreamWriter(fos, encoding);
                   format.setEncoding(encoding);
                   Serializer serializer = new XMLSerializer(writer, format);
                   Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
  @@ -652,6 +654,15 @@
                   try
                   {
                       writer.close();
  +                }
  +                catch (Exception e)
  +                {
  +                    logger.error("Exception", e);  // At least log the exception.
  +                }
  +                
  +                try
  +                {
  +                    fos.close();
                   }
                   catch (Exception e)
                   {
  
  
  
  1.44      +5 -2      jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
  
  Index: CastorPsmlManagerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- CastorPsmlManagerService.java	23 Mar 2004 21:05:40 -0000	1.43
  +++ CastorPsmlManagerService.java	31 Mar 2004 00:23:02 -0000	1.44
  @@ -551,10 +551,12 @@
           }
   
           OutputStreamWriter writer = null;
  +        FileOutputStream fos = null;
           try
           {
               String encoding = this.defaultEncoding;
  -            writer = new OutputStreamWriter(new FileOutputStream(f), encoding);
  +            fos = new FileOutputStream(f);
  +            writer = new OutputStreamWriter(fos, encoding);
   
               save(writer, doc.getPortlets());
               success = true;
  @@ -582,6 +584,7 @@
           finally
           {
               try { writer.close(); } catch (IOException e) {}
  +            try { if(fos != null) { fos.close(); } } catch (IOException e) {}
           }
   
           return success;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message