Fix for possible NULL S
authorpkanavos <pkanavos@gmail.com>
Mon, 2 Jul 2012 08:43:39 +0000 (11:43 +0300)
committerpkanavos <pkanavos@gmail.com>
Mon, 2 Jul 2012 08:43:39 +0000 (11:43 +0300)
trunk/Pithos.Core/Agents/PollAgent.cs

index 466c997..0eff9a4 100644 (file)
@@ -603,9 +603,19 @@ namespace Pithos.Core.Agents
                         {\r
                             // (Identical Changes) Result: L = S\r
                             //doNothing()\r
-                            //Detect server moves\r
-                            var targetPath = MoveForServerMove(accountInfo, tuple);\r
-                            StatusKeeper.StoreInfo(targetPath, tuple.ObjectInfo);\r
+                            \r
+                            //Don't update anything for nonexistend server files\r
+                            if (tuple.S != null)\r
+                            {\r
+                                //Detect server moves\r
+                                var targetPath = MoveForServerMove(accountInfo, tuple);\r
+                                StatusKeeper.StoreInfo(targetPath, tuple.ObjectInfo);\r
+                            }\r
+                            else\r
+                            {\r
+                                //Log the null tuple for investigation\r
+                                Log.WarnFormat("Null tuple detected Path:[{0}], State:[{1}],LocalFile:[{2}]",tuple.FilePath,tuple.FileState,tuple.FileInfo);\r
+                            }\r
                         }\r
                         else\r
                         {\r
@@ -646,7 +656,8 @@ namespace Pithos.Core.Agents
             var serverPath = Path.Combine(accountInfo.AccountPath, relativePath);\r
             \r
             //Compare Case Insensitive\r
-            if (String.Equals(tuple.FilePath ,serverPath,StringComparison.InvariantCultureIgnoreCase)) return serverPath;\r
+            if (String.Equals(tuple.FilePath ,serverPath,StringComparison.InvariantCultureIgnoreCase)) \r
+                return serverPath;\r
 \r
             if (tuple.FileInfo.Exists)\r
             {\r