[mono/monodevelop] 07019e10: [MacPlatform] Instead of throwing exceptions on unknown keychain errors, just return null

"Jeffrey Stedfast ([email protected])" <[email protected]> Thu, 7 Nov 2013 22:13:32 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014234a0a356-cb3aeaae-b97f-4079-8385-2dcf9bc625ed-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/4ad78b6bb399...07019e10404e

   Commit: 07019e10404ed00d3bd2860ba3e3a0fb79ac10b4
   Author: Jeffrey Stedfast <[email protected]> (jstedfast)
     Date: 2013-11-07 22:12:17 GMT
      URL: https://github.com/mono/monodevelop/commit/07019e10404ed00d3bd2860ba3e3a0fb79ac10b4

[MacPlatform] Instead of throwing exceptions on unknown keychain errors, just return null

Fixes bug #16017

Changed paths:
  M main/src/addins/MacPlatform/MacInterop/Keychain.cs

Modified: main/src/addins/MacPlatform/MacInterop/Keychain.cs
===================================================================
@@ -528,11 +528,8 @@ static unsafe string GetUsernameFromKeychainItemRef (IntPtr itemRef)
 			                                              0, null, (uint) path.Length, path, (ushort) uri.Port,
 			                                              protocol, auth, out passwordLength, out passwordData, ref item);
 
-			if (result == OSStatus.ItemNotFound)
-				return null;
-
 			if (result != OSStatus.Ok)
-				throw new Exception ("Could not find internet username and password: " + GetError (result));
+				return null;
 
 			var username = GetUsernameFromKeychainItemRef (item);
 
@@ -564,11 +561,8 @@ public static string FindInternetPassword (Uri uri)
 
 			CFRelease (item);
 
-			if (result == OSStatus.ItemNotFound)
-				return null;
-
 			if (result != OSStatus.Ok)
-				throw new Exception ("Could not find internet password: " + GetError (result));
+				return null;
 
 			return Marshal.PtrToStringAuto (passwordData, (int) passwordLength);
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches