Minor fix in Selective sync to ignore 403 errors the first time new share listings...
[pithos-ms-client] / trunk / Pithos.Core / Agents / PollAgent.cs
index da6bf20..d1974bf 100644 (file)
@@ -660,36 +660,44 @@ namespace Pithos.Core.Agents
             var client = new CloudFilesClient(accountInfo);\r
             foreach (var folderUri in added)\r
             {\r
-                string account;\r
-                string container;\r
-                var segmentsCount = folderUri.Segments.Length;\r
-                if (segmentsCount < 3)\r
-                    continue;\r
-                if (segmentsCount==3)\r
-                {\r
-                    account = folderUri.Segments[1].TrimEnd('/');\r
-                    container = folderUri.Segments[2].TrimEnd('/');                    \r
-                }\r
-                else\r
-                {\r
-                    account = folderUri.Segments[2].TrimEnd('/');\r
-                    container = folderUri.Segments[3].TrimEnd('/');                    \r
-                }\r
-                IList<ObjectInfo> items;\r
-                if(segmentsCount>3)\r
+                try\r
                 {\r
-                    var folder =String.Join("", folderUri.Segments.Splice(4));\r
-                    items = client.ListObjects(account, container, folder);\r
+\r
+                    string account;\r
+                    string container;\r
+                    var segmentsCount = folderUri.Segments.Length;\r
+                    if (segmentsCount < 3)\r
+                        continue;\r
+                    if (segmentsCount == 3)\r
+                    {\r
+                        account = folderUri.Segments[1].TrimEnd('/');\r
+                        container = folderUri.Segments[2].TrimEnd('/');\r
+                    }\r
+                    else\r
+                    {\r
+                        account = folderUri.Segments[2].TrimEnd('/');\r
+                        container = folderUri.Segments[3].TrimEnd('/');\r
+                    }\r
+                    IList<ObjectInfo> items;\r
+                    if (segmentsCount > 3)\r
+                    {\r
+                        var folder = String.Join("", folderUri.Segments.Splice(4));\r
+                        items = client.ListObjects(account, container, folder);\r
+                    }\r
+                    else\r
+                    {\r
+                        items = client.ListObjects(account, container);\r
+                    }\r
+                    var actions = CreatesToActions(accountInfo, items);\r
+                    foreach (var action in actions)\r
+                    {\r
+                        NetworkAgent.Post(action);\r
+                    }\r
                 }\r
-                else\r
+                catch (Exception exc)\r
                 {\r
-                    items = client.ListObjects(account, container);\r
+                    Log.WarnFormat("Listing of new selective path [{0}] failed with \r\n{1}", folderUri, exc);\r
                 }\r
-                var actions=CreatesToActions(accountInfo, items);\r
-                foreach (var action in actions)\r
-                {\r
-                    NetworkAgent.Post(action);    \r
-                }                \r
             }\r
 \r
             //Need to get a listing of each of the URLs, then post them to the NetworkAgent\r