Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-24 Thread Martin Hewitson
Gentlemen, thank you for those succinct responses. I'll go through my code base and make the necessary changes. Best wishes, Martin On 24, Jun, 2012, at 07:55 AM, Conrad Shultz wrote: As Roland indicated, yes, this is a general statement. It would be advisable to read the Error Handling

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-24 Thread Dennis
On Jun 23, 2012, at 10:46 PM, Roland King wrote: Yes that is a general statement. You should check the return value of the method and only if it indicates there's an error, check the error object. There is no guarantee that the error object was not set at some point during the method

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-24 Thread Roland King
No. On 24 Jun, 2012, at 11:14 PM, Dennis li...@dbandel.com wrote: On Jun 23, 2012, at 10:46 PM, Roland King wrote: Yes that is a general statement. You should check the return value of the method and only if it indicates there's an error, check the error object. There is no guarantee

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-24 Thread Martin Hewitson
On 24, Jun, 2012, at 05:14 PM, Dennis wrote: On Jun 23, 2012, at 10:46 PM, Roland King wrote: Yes that is a general statement. You should check the return value of the method and only if it indicates there's an error, check the error object. There is no guarantee that the error object

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-24 Thread Jens Alfke
On Jun 24, 2012, at 8:14 AM, Dennis wrote: What if you explicitly set your NSError variable's value to nil immediately before using it? Wouldn't it be safe to trust in that case? To expand on Roland's pithy No: * You call method A with an NSError** that points to a nil pointer. * A calls B,

False positive on writeToURL:atomically:encoding:error: ?

2012-06-23 Thread Martin Hewitson
Dear list, I have an interesting bug report from a user of an app of mine. The app manages files and allows the user to edit them. When they save the project each file is saved to disk (if necessary). They are experiencing what appears to be a false positive

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-23 Thread Eeyore
, Martin Hewitson wrote: Dear list, I have an interesting bug report from a user of an app of mine. The app manages files and allows the user to edit them. When they save the project each file is saved to disk (if necessary). They are experiencing what appears to be a false positive

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-23 Thread Jeff Kelley
files and allows the user to edit them. When they save the project each file is saved to disk (if necessary). They are experiencing what appears to be a false positive of writeToURL:atomically:encoding:error:. The file actually does save, but the error comes back non-nil and when presented

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-23 Thread Martin Hewitson
from a user of an app of mine. The app manages files and allows the user to edit them. When they save the project each file is saved to disk (if necessary). They are experiencing what appears to be a false positive of writeToURL:atomically:encoding:error:. The file actually does save

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-23 Thread Roland King
On Jun 24, 2012, at 1:35 PM, Martin Hewitson wrote: Just a quick follow up on this. It's been stated that it's unsafe to check the error returned from -writeToURL:atomically:encoding:error: and rather one should check the return value. Is this a general statement for other methods which

Re: False positive on writeToURL:atomically:encoding:error: ?

2012-06-23 Thread Conrad Shultz
As Roland indicated, yes, this is a general statement. It would be advisable to read the Error Handling Programming Guide, which includes, among other things: Important Success or failure is indicated by the return value of the method. Although Cocoa methods that indirectly return error