DotCMIS: more quick fixes
git-svn-id: https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk@1510570 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMIS/binding/atompub/atompub-parser.cs b/DotCMIS/binding/atompub/atompub-parser.cs
index f3bcbf8..3da7cd9 100644
--- a/DotCMIS/binding/atompub/atompub-parser.cs
+++ b/DotCMIS/binding/atompub/atompub-parser.cs
@@ -80,56 +80,55 @@
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;
- XmlReader reader = XmlReader.Create(stream, settings);
- try
- {
- while (true)
+ try {
+ using (XmlReader reader = XmlReader.Create(stream, settings))
{
- if (reader.IsStartElement())
+ while (true)
{
- if (AtomPubConstants.NamespaceAtom == reader.NamespaceURI)
+ if (reader.IsStartElement())
{
- if (AtomPubConstants.TagFeed == reader.LocalName)
+ if (AtomPubConstants.NamespaceAtom == reader.NamespaceURI)
{
- parseResult = ParseFeed(reader);
- break;
+ if (AtomPubConstants.TagFeed == reader.LocalName)
+ {
+ parseResult = ParseFeed(reader);
+ break;
+ }
+ else if (AtomPubConstants.TagEntry == reader.LocalName)
+ {
+ parseResult = ParseEntry(reader);
+ break;
+ }
}
- else if (AtomPubConstants.TagEntry == reader.LocalName)
+ else if (AtomPubConstants.NamespaceCMIS == reader.NamespaceURI)
{
- parseResult = ParseEntry(reader);
- break;
+ if (AtomPubConstants.TagAllowableActions == reader.LocalName)
+ {
+ parseResult = ParseAllowableActions(reader);
+ break;
+ }
+ else if (AtomPubConstants.TagACL == reader.LocalName)
+ {
+ parseResult = ParseACL(reader);
+ break;
+ }
+ }
+ else if (AtomPubConstants.NamespaceAPP == reader.NamespaceURI)
+ {
+ if (AtomPubConstants.TagService == reader.LocalName)
+ {
+ parseResult = ParseServiceDoc(reader);
+ break;
+ }
}
}
- else if (AtomPubConstants.NamespaceCMIS == reader.NamespaceURI)
- {
- if (AtomPubConstants.TagAllowableActions == reader.LocalName)
- {
- parseResult = ParseAllowableActions(reader);
- break;
- }
- else if (AtomPubConstants.TagACL == reader.LocalName)
- {
- parseResult = ParseACL(reader);
- break;
- }
- }
- else if (AtomPubConstants.NamespaceAPP == reader.NamespaceURI)
- {
- if (AtomPubConstants.TagService == reader.LocalName)
- {
- parseResult = ParseServiceDoc(reader);
- break;
- }
- }
- }
- if (!reader.Read()) { break; }
+ if (!reader.Read()) { break; }
+ }
}
}
finally
{
- try { reader.Close(); }
- catch (Exception) { }
try { stream.Close(); }
catch (Exception) { }
}