Closed
Bug 431806
Opened 18 years ago
Closed 18 years ago
Unnecessary warnings when opening a local .eml file
Categories
(MailNews Core :: Backend, defect)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.9
People
(Reporter: rkent, Assigned: rkent)
Details
Attachments
(1 file, 2 obsolete files)
|
3.86 KB,
patch
|
rkent
:
review+
rkent
:
superreview+
|
Details | Diff | Splinter Review |
In debug mode, when opening a local .eml file for display, you receive two warnings in nsMailBoxUrl.cpp. The first is NS_ENSURE_TRUE(msg) failed at line 447, the second is NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 at line 455
These warnings can be traced to attempts to get the folder character set, which is meaningless for a file email. So these warnings are for operations that occur during the normal course of events, and should not generate console warnings. Reading and processing of the email proceeds normally even with the warnings.
While these error messages are rather trivial during normal operation, during testing of the bayesian filter they generate huge amounts of console noise. The easiest way to pipe an email to the bayesian filter, either for unit test or for effectiveness testing, is to read a file email in the same manner.
Change the testing in these routines so no warning is shown, but the error is passed up the chain where it is then properly handled.
| Assignee | ||
Comment 1•18 years ago
|
||
There's another warning I also want to fix in this bug. This is at http://mxr.mozilla.org/seamonkey/source/mailnews/db/msgdb/src/nsMsgDatabase.cpp#153 where I get "NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80550006" when the routine fails to find folder flags. As with the other warning, just detect this and pass it to the caller without a warning.
| Assignee | ||
Updated•18 years ago
|
Summary: nsMailboxUrl.cpp warnings when opening a local .eml file → Unnecessary warnings when opening a local .eml file
| Assignee | ||
Comment 2•18 years ago
|
||
Attachment #319503 -
Flags: superreview?(bienvenu)
Attachment #319503 -
Flags: review?(bienvenu)
Comment 3•18 years ago
|
||
Comment on attachment 319503 [details] [diff] [review]
Replace warnings with simple error returns
I'm going to jump in here.
@@ -145,17 +145,18 @@ NS_IMETHODIMP nsMsgDBService::OpenFolder
{
PRInt32 numMessages;
msgDatabase->m_mdbAllMsgHeadersTable->GetCount(msgDatabase->GetEnv(), &numHdrsInTable);
msgDatabase->m_dbFolderInfo->GetNumMessages(&numMessages);
if (numMessages != (PRInt32) numHdrsInTable)
msgDatabase->SyncCounts();
}
}
- NS_ENSURE_SUCCESS(rv, rv);
+ if (NS_FAILED(rv))
+ return rv;
Please see my comment on bug 421050 comment 3 and bug 421050 comment 9. I'd prefer slightly more detail here, because there are only two cases we expect this to fail. Anything else and at least in debug mode we should warn the developer.
Attachment #319503 -
Flags: review?(bienvenu) → review-
| Assignee | ||
Comment 4•18 years ago
|
||
I see that bug 421050 is trying to cure the same warning that I mention in comment 1. Since that bug is ahead of this one, I'll defer to it and eliminate the change.
That still leaves the changes associated with the warnings in comment 0. I don't see how to approach those in the manner as your comments on the other section, since there is no upstream error code to check. What do you suggest?
Comment 5•18 years ago
|
||
(In reply to comment #4)
> That still leaves the changes associated with the warnings in comment 0. I
> don't see how to approach those in the manner as your comments on the other
> section, since there is no upstream error code to check. What do you suggest?
That's a good point. I'm actually not too worried on these ones, because they aren't quite as prominent. It would be good though to add some comments to the code about what's going on, especially in GetFolderCharset, and probably to the idl as well, saying that it may return failure if the url doesn't have a folder associated with it.
We probably should also set *aCharacterSet to nsnull at the start of that function, and NS_ENSURE_ARG_POINTER on it as well.
Comment 6•18 years ago
|
||
Comment on attachment 319503 [details] [diff] [review]
Replace warnings with simple error returns
I'm OK with this, modulo Standard8's comments.
Attachment #319503 -
Flags: superreview?(bienvenu) → superreview+
| Assignee | ||
Comment 7•18 years ago
|
||
Attachment #319503 -
Attachment is obsolete: true
Attachment #319672 -
Flags: review?(bugzilla)
Comment 8•18 years ago
|
||
Comment on attachment 319672 [details] [diff] [review]
More comments, no nsMsgDatabase.cpp change
>+
>+ // fails with NS_ERROR_FAILURE for standalone .eml messages
> attribute nsIMsgFolder folder;
Could you make this:
/**
* The folder associated with this url.
*
* @exception NS_ERROR_FAILURE May be thrown if the url does not
* relate to a folder, e.g. standalone
* .eml messages.
*/
>+ // fails with NS_ERROR_FAILURE for standalone .eml messages
> readonly attribute string folderCharset;
I think this could be commented in the same way.
> NS_IMETHODIMP nsMailboxUrl::GetFolderCharset(char ** aCharacterSet)
> {
> nsCOMPtr<nsIMsgFolder> folder;
>+ NS_ENSURE_ARG_POINTER(aCharacterSet);
Please put the NS_ENSURE... before the nsCOMPtr declaration.
r=me with those fixed.
Attachment #319672 -
Flags: review?(bugzilla) → review+
| Assignee | ||
Comment 9•18 years ago
|
||
Ready to checkin, carrying over r and sr.
Attachment #319672 -
Attachment is obsolete: true
Attachment #319857 -
Flags: superreview+
Attachment #319857 -
Flags: review+
| Assignee | ||
Updated•18 years ago
|
Keywords: checkin-needed
Comment 10•18 years ago
|
||
Adding checkin-needed while mail/mailnews is frozen is just going to lead someone who doesn't know we're frozen to check it in at the wrong time.
Keywords: checkin-needed
Comment 11•18 years ago
|
||
Patch checked in:
Checking in mailnews/base/public/nsIMsgMailNewsUrl.idl;
/cvsroot/mozilla/mailnews/base/public/nsIMsgMailNewsUrl.idl,v <-- nsIMsgMailNewsUrl.idl
new revision: 1.35; previous revision: 1.34
done
Checking in mailnews/local/src/nsMailboxUrl.cpp;
/cvsroot/mozilla/mailnews/local/src/nsMailboxUrl.cpp,v <-- nsMailboxUrl.cpp
new revision: 1.116; previous revision: 1.115
done
| Assignee | ||
Comment 13•18 years ago
|
||
Yep, it's fixed. Fixing.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•17 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•