You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/08/05 17:35:45 UTC

svn commit: r1510570 - /chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs

Author: fmui
Date: Mon Aug  5 15:35:45 2013
New Revision: 1510570

URL: http://svn.apache.org/r1510570
Log:
DotCMIS: more quick fixes

Modified:
    chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs?rev=1510570&r1=1510569&r2=1510570&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs Mon Aug  5 15:35:45 2013
@@ -80,56 +80,55 @@ namespace DotCMIS.Binding.AtomPub
             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 (AtomPubConstants.TagFeed == reader.LocalName)
-                            {
-                                parseResult = ParseFeed(reader);
-                                break;
-                            }
-                            else if (AtomPubConstants.TagEntry == reader.LocalName)
-                            {
-                                parseResult = ParseEntry(reader);
-                                break;
-                            }
-                        }
-                        else if (AtomPubConstants.NamespaceCMIS == reader.NamespaceURI)
+                        if (reader.IsStartElement())
                         {
-                            if (AtomPubConstants.TagAllowableActions == reader.LocalName)
+                            if (AtomPubConstants.NamespaceAtom == reader.NamespaceURI)
                             {
-                                parseResult = ParseAllowableActions(reader);
-                                break;
+                                if (AtomPubConstants.TagFeed == reader.LocalName)
+                                {
+                                    parseResult = ParseFeed(reader);
+                                    break;
+                                }
+                                else if (AtomPubConstants.TagEntry == reader.LocalName)
+                                {
+                                    parseResult = ParseEntry(reader);
+                                    break;
+                                }
                             }
-                            else if (AtomPubConstants.TagACL == reader.LocalName)
+                            else if (AtomPubConstants.NamespaceCMIS == reader.NamespaceURI)
                             {
-                                parseResult = ParseACL(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)
+                            else if (AtomPubConstants.NamespaceAPP == reader.NamespaceURI)
                             {
-                                parseResult = ParseServiceDoc(reader);
-                                break;
+                                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) { }
             }