chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1510570 - /chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-parser.cs
Date Mon, 05 Aug 2013 15:35:45 GMT
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) { }
             }



Mime
View raw message