Parcourir la source

svn path=/trunk/mcs/; revision=47518

Rafael Mizrahi il y a 20 ans
Parent
commit
8002bc489b

+ 4 - 0
mcs/class/System.XML/Test/System.Xml/W3C/ChangeLog

@@ -1,3 +1,7 @@
+2005-07-21  Rafael Mizrahi  <[email protected]>
+
+	* xmlconf.cs: Close readers handlers in order to free file descriptors.
+ 
 2005-06-30  Andrew Skiba  <[email protected]>
 
 	* Makefile: change targets for nunit based tests

+ 13 - 2
mcs/class/System.XML/Test/System.Xml/W3C/xmlconf.cs

@@ -31,6 +31,7 @@ namespace MonoTests.W3C_xmlconf {
 					if (s.Length > 0)
 						array.Add (s);
 				}
+				reader.Close();
 			}
 		}
 		#endregion
@@ -164,8 +165,9 @@ namespace MonoTests.W3C_xmlconf {
 
 		bool TestNonValidating (string uri)
 		{
+			XmlTextReader trd = null;
 			try {
-				XmlTextReader trd = new XmlTextReader (uri);
+				trd = new XmlTextReader (uri);
 				new XmlDocument ().Load (trd);
 				return true;
 			}
@@ -173,12 +175,17 @@ namespace MonoTests.W3C_xmlconf {
 				_stackTrace = e.StackTrace;
 				return false;
 			}
+			finally {
+				if (trd != null)
+					trd.Close();
+			}
 		}
 
 		bool TestValidating (string uri)
 		{
+			XmlTextReader rd = null;
 			try {
-				XmlTextReader rd = new XmlTextReader (uri);
+				rd = new XmlTextReader (uri);
 				XmlValidatingReader vrd = new XmlValidatingReader (rd);
 				new XmlDocument ().Load (vrd);
 				return true;
@@ -187,6 +194,10 @@ namespace MonoTests.W3C_xmlconf {
 				_stackTrace = e.StackTrace; //rewrites existing, possibly, but it's ok
 				return false;
 			}
+			finally {
+				if (rd != null) 
+					rd.Close();				
+			}
 		}
 
 		public override void Run (TestCaseResult res)