Author: atsushi
Date: 2005-05-31 09:37:32 -0400 (Tue, 31 May 2005)
New Revision: 45262
Modified:
trunk/mcs/class/System.XML/System.Xml/ChangeLog
trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
trunk/mcs/class/System.XML/System.Xml/DTDReader.cs
trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
Log:
2005-05-31 Atsushi Enomoto <[EMAIL PROTECTED]>
* DTDReader.cs :
make sure to close parser input before parser stack pop.
* DTDValidatingReader.cs : ditto.
* DTDObjectModel.cs : Fixed another incorrect null BaseURI check.
* XmlValidatingReaderTests.cs : let's test external DTD as well.
Modified: trunk/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/ChangeLog 2005-05-31 13:08:00 UTC
(rev 45261)
+++ trunk/mcs/class/System.XML/System.Xml/ChangeLog 2005-05-31 13:37:32 UTC
(rev 45262)
@@ -1,5 +1,12 @@
2005-05-31 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * DTDReader.cs :
+ make sure to close parser input before parser stack pop.
+ * DTDValidatingReader.cs : ditto.
+ * DTDObjectModel.cs : Fixed another incorrect null BaseURI check.
+
+2005-05-31 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* DTDValidatingReader.cs : Last BaseURI exposed this hidden bug via
sys.security tests.
Modified: trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs 2005-05-31
13:08:00 UTC (rev 45261)
+++ trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs 2005-05-31
13:37:32 UTC (rev 45262)
@@ -262,7 +262,7 @@
return null;
if (entity.SystemId != null) {
- Uri baseUri = entity.BaseURI == null ? null :
new Uri (entity.BaseURI);
+ Uri baseUri = entity.BaseURI == String.Empty ?
null : new Uri (entity.BaseURI);
Stream stream = resolver.GetEntity
(resolver.ResolveUri (baseUri, entity.SystemId), null, typeof (Stream)) as
Stream;
return new XmlTextReaderImpl (stream,
XmlNodeType.Element, context);
}
Modified: trunk/mcs/class/System.XML/System.Xml/DTDReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDReader.cs 2005-05-31 13:08:00 UTC
(rev 45261)
+++ trunk/mcs/class/System.XML/System.Xml/DTDReader.cs 2005-05-31 13:37:32 UTC
(rev 45262)
@@ -1610,10 +1610,13 @@
throw NotWFError ("Nested inclusion is
not allowed: " + url);
}
parserInputStack.Push (currentInput);
+ Stream s = null;
try {
- Stream s = DTD.Resolver.GetEntity (absUri,
null, typeof (Stream)) as Stream;
+ s = DTD.Resolver.GetEntity (absUri, null,
typeof (Stream)) as Stream;
currentInput = new XmlParserInput (new
XmlStreamReader (s), absPath);
} catch (Exception ex) { // FIXME: (wishlist) Bad
exception catch ;-(
+ if (s != null)
+ s.Close ();
int line = currentInput == null ? 0 :
currentInput.LineNumber;
int col = currentInput == null ? 0 :
currentInput.LinePosition;
string bu = (currentInput == null) ?
String.Empty : currentInput.BaseURI;
@@ -1625,6 +1628,7 @@
private void PopParserInput ()
{
+ currentInput.Close ();
currentInput = parserInputStack.Pop () as
XmlParserInput;
}
Modified: trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
2005-05-31 13:08:00 UTC (rev 45261)
+++ trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
2005-05-31 13:37:32 UTC (rev 45262)
@@ -396,6 +396,7 @@
nextEntityReader = null;
return ReadContent ();
} else if (reader.EOF && entityReaderStack.Count > 0) {
+ reader.Close ();
reader = entityReaderStack.Pop () as XmlReader;
entityReaderDepthStack.Pop ();
sourceTextReader = reader as XmlTextReader;
Modified: trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2005-05-31
13:08:00 UTC (rev 45261)
+++ trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2005-05-31
13:37:32 UTC (rev 45262)
@@ -1,5 +1,9 @@
2005-05-31 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * XmlValidatingReaderTests.cs : let's test external DTD as well.
+
+2005-05-31 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* XmlValidatingReaderTests.cs : added ResolveEntityAndBaseURI() which
is imported from sys.security.
Modified: trunk/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
2005-05-31 13:08:00 UTC (rev 45261)
+++ trunk/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs
2005-05-31 13:37:32 UTC (rev 45262)
@@ -824,8 +824,11 @@
using (TextWriter w = File.CreateText
("world.txt")) {
w.WriteLine ("world");
}
+ using (TextWriter w = File.CreateText
("doc.dtd")) {
+ w.WriteLine ("<!-- dummy -->");
+ }
- string xml = "<!DOCTYPE doc [\n" +
+ string xml = "<!DOCTYPE doc SYSTEM \"doc.dtd\"
[\n" +
"<!ATTLIST doc attrExtEnt ENTITY
#IMPLIED>\n" +
"<!ENTITY ent1 \"Hello\">\n" +
"<!ENTITY ent2 SYSTEM \"world.txt\">\n"
+
@@ -850,6 +853,8 @@
} finally {
if (File.Exists ("world.txt"))
File.Delete ("world.txt");
+ if (File.Exists ("doc.dtd"))
+ File.Delete ("doc.dtd");
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches