You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2002/05/15 19:02:53 UTC

cvs commit: xml-axis/java/src/org/apache/axis/utils XMLUtils.java

scheu       02/05/15 10:02:53

  Modified:    java/src/org/apache/axis/utils XMLUtils.java
  Log:
  When a XMLUtils.newDocument creates an InputSource it should close the
  streams after they are used.
  
  Revision  Changes    Path
  1.49      +9 -1      xml-axis/java/src/org/apache/axis/utils/XMLUtils.java
  
  Index: XMLUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/XMLUtils.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- XMLUtils.java	7 May 2002 19:52:02 -0000	1.48
  +++ XMLUtils.java	15 May 2002 17:02:53 -0000	1.49
  @@ -264,7 +264,15 @@
        */ 
       public static Document newDocument(String uri, String username, String password) {
           try {
  -            return XMLUtils.newDocument(XMLUtils.getInputSourceFromURI(uri, username, password));
  +            InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password);
  +            Document doc = XMLUtils.newDocument(ins);
  +            // Close the Stream
  +            if (ins.getByteStream() != null) {
  +                ins.getByteStream().close();
  +            } else if (ins.getCharacterStream() != null) {
  +                ins.getCharacterStream().close();
  +            }
  +            return doc;
           } catch (Exception e) {
               log.error(JavaUtils.getMessage("exception00"), e);
           }