glyn        02/02/12 01:42:17

  Modified:    java/src/org/apache/axis/wsdl/fromJava Emitter.java
  Log:
  Close file after emission.
  
  Fix supplied by Thomas Börkel.
  
  Revision  Changes    Path
  1.14      +18 -7     xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Emitter.java      8 Feb 2002 17:45:39 -0000       1.13
  +++ Emitter.java      12 Feb 2002 09:42:17 -0000      1.14
  @@ -174,13 +174,11 @@
           Document doc = WSDLFactory.newInstance().
               newWSDLWriter().getDocument(intf);
           types.insertTypesFragment(doc);
  -        XMLUtils.PrettyDocumentToStream(doc, 
  -                    new FileOutputStream(new File(filename1)));
  +        prettyDocumentToFile(doc, filename1);
   
           // Write out the implementation def 
           doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(impl);
  -        XMLUtils.PrettyDocumentToStream(doc, 
  -                    new FileOutputStream(new File(filename2)));
  +        prettyDocumentToFile(doc, filename2);
       }
   
       /**
  @@ -280,9 +278,8 @@
                   break;
               }
           }
  -            
  -        XMLUtils.PrettyDocumentToStream(doc, 
  -          new FileOutputStream(new File(filename)));
  +
  +        prettyDocumentToFile(doc, filename);
       }
   
       /**
  @@ -782,6 +779,20 @@
           }
           return qName;
       }
  +
  +    /**
  +     * Write a prettified document to a file.
  +     *
  +     * @param doc the Document to write
  +     * @param filename the name of the file to be written
  +     * @throws Exception various file i/o exceptions
  +     */
  +    private void prettyDocumentToFile(Document doc, String filename) 
  +        throws Exception {
  +        FileOutputStream fos = new FileOutputStream(new File(filename));  
  +        XMLUtils.PrettyDocumentToStream(doc, fos);
  +        fos.close();
  +     }
   
       // -------------------- Parameter Query Methods ----------------------------//
       
  
  
  


Reply via email to