Author: kostat
Date: 2007-05-16 02:12:30 -0400 (Wed, 16 May 2007)
New Revision: 77453

Modified:
   branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/ChangeLog
   branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlTextWriter2.cs
   branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlWriter.cs
Log:
merge -r77449:77450

Modified: branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/ChangeLog    
2007-05-16 06:10:13 UTC (rev 77452)
+++ branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/ChangeLog    
2007-05-16 06:12:30 UTC (rev 77453)
@@ -1,3 +1,8 @@
+2007-05-15  Konstantin Triger <[EMAIL PROTECTED]>
+
+       * XmlWriter.cs, XmlTextWriter2.cs: ensure the file
+               is closed in XmlWriter.Create(filename).
+
 2007-04-03  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * XmlTextReader.cs : character ']' inside DTD comment caused parser

Modified: 
branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlTextWriter2.cs
===================================================================
--- branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlTextWriter2.cs    
2007-05-16 06:10:13 UTC (rev 77452)
+++ branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlTextWriter2.cs    
2007-05-16 06:12:30 UTC (rev 77453)
@@ -263,14 +263,14 @@
 
 #if NET_2_0
                internal XmlTextWriter (
-                       TextWriter writer, XmlWriterSettings settings)
+                       TextWriter writer, XmlWriterSettings settings, bool 
closeOutput)
                {
                        if (settings == null)
                                settings = new XmlWriterSettings ();
 
                        Initialize (writer);
 
-                       close_output_stream = settings.CloseOutput;
+                       close_output_stream = closeOutput;
                        allow_doc_fragment =
                                settings.ConformanceLevel != 
ConformanceLevel.Document;
                        switch (settings.ConformanceLevel) {

Modified: branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlWriter.cs
===================================================================
--- branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlWriter.cs 
2007-05-16 06:10:13 UTC (rev 77452)
+++ branches/mainsoft/gh20/mcs/class/System.XML/System.Xml/XmlWriter.cs 
2007-05-16 06:12:30 UTC (rev 77453)
@@ -125,7 +125,7 @@
                public static XmlWriter Create (string file, XmlWriterSettings 
settings)
                {
                        Encoding enc = settings != null ? settings.Encoding : 
Encoding.UTF8;
-                       return Create (new StreamWriter (file, false, enc), 
settings);
+                       return CreateTextWriter (new StreamWriter (file, false, 
enc), settings, true);
                }
 
                public static XmlWriter Create (StringBuilder builder, 
XmlWriterSettings settings)
@@ -135,7 +135,9 @@
 
                public static XmlWriter Create (TextWriter writer, 
XmlWriterSettings settings)
                {
-                       return CreateTextWriter (writer, settings);
+                       if (settings == null)
+                               settings = new XmlWriterSettings ();
+                       return CreateTextWriter (writer, settings, 
settings.CloseOutput);
                }
 
                public static XmlWriter Create (XmlWriter writer, 
XmlWriterSettings settings)
@@ -146,11 +148,11 @@
                        return writer;
                }
 
-               private static XmlWriter CreateTextWriter (TextWriter writer, 
XmlWriterSettings settings)
+               private static XmlWriter CreateTextWriter (TextWriter writer, 
XmlWriterSettings settings, bool closeOutput)
                {
                        if (settings == null)
                                settings = new XmlWriterSettings ();
-                       XmlTextWriter xtw = new XmlTextWriter (writer, 
settings);
+                       XmlTextWriter xtw = new XmlTextWriter (writer, 
settings, closeOutput);
                        return Create (xtw, settings);
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to