Closed
Bug 167579
Opened 23 years ago
Closed 23 years ago
Make copyService more robust to handle failure cases.
Categories
(MailNews Core :: Backend, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: naving, Assigned: naving)
References
Details
Attachments
(1 file, 1 obsolete file)
18.30 KB,
patch
|
cavin
:
review+
naving
:
superreview+
|
Details | Diff | Splinter Review |
We talked about some cases over aim.
Assignee | ||
Comment 1•23 years ago
|
||
I have addressed error handling cases in CopyMessages and CopyFileMessage for
both local and imap. Basically I am passing srcSupport to OnCopyCompleted so
that it can be called when we haven't even inited a copyState object. Also I
removed some of null check for arguments because copyService does that and we
are using copyService for all copies (inlcluding patches I have, but not
checked in). In copyService I made it so that we queue request only if
destination is same and checked it works because we mark copySource processed
once we are issuing a copy so there is no chance of an infinite loop!
David, can you review ? thx.
Assignee | ||
Comment 2•23 years ago
|
||
still looking may come up w/ better patch.
Summary: Make copyService more robust to handle failure cases. → Make copyService more robust to handle failure cases.
Comment 3•23 years ago
|
||
OK, while you're coming up with another patch:
if (m_copyState)
- {
- nsCOMPtr<nsISupports> srcSupport =
do_QueryInterface(m_copyState->m_srcSupport);
m_copyState = nsnull;
this can just be
m_copyState = nsnull; right? no need to check if it's not null before.
+nsMsgCopyService::QueueRequest(nsCopyRequest* aRequest, PRBool *aResult)
could we make the variable name aResult have a more meaningful?
Assignee | ||
Comment 4•23 years ago
|
||
No, I thought about it doesn't look to be possible. yes, I have changed those
two lines in my tree. Can you do a full review because I have lot of changes in
my tree.
Comment 5•23 years ago
|
||
+ nsresult QueueRequest(nsCopyRequest* aRequest, PRBool *aResult);
this line should change too (more descriptive var name)
this comment should change, right? To something about "if there wasn't another
request for this dest folder..." or something like that.
//if only one request, then go ahead and do the copy, otherwise the request is
queued
fix (remove) the comment here:
+ return OnCopyCompleted(srcSupport, PR_FALSE); // I think we want to
return ok here
Here:
all of the early returns here will leave us with a copy request left hanging
around, right? We don't want that. Either all these control paths should call
::OnCopyCompleted or we could have some way in the copy service of knowing that
the copy never got started (checking the rv, as I suggested before, is one
possibility). Another possibility is to have some sort of accessor on
nsIMsgFolder that tells you whether a copy state is attached or not. We really
should strive to not have returns that leave the copy request hanging around,
unless we're going to check for an error return in the copy service.
@@ -1630,24 +1630,19 @@
return NS_MSG_FOLDER_BUSY;
rv = GetPath(getter_AddRefs(pathSpec));
- if (NS_FAILED(rv)) goto done;
+ NS_ENSURE_SUCCESS(rv, rv);
rv = pathSpec->GetFileSpec(&path);
- if (NS_FAILED(rv)) goto done;
+ NS_ENSURE_SUCCESS(rv, rv);
Assignee | ||
Comment 6•23 years ago
|
||
I have fixes for those minor nits. Those early returns are ok because they are
in InitCopyState which if fails is caught in CopyMessages or CopyFileMessage
where we call OnCopyCompleted.
Assignee | ||
Comment 7•23 years ago
|
||
David, just a reminder to complete the review.
Status: NEW → ASSIGNED
Comment 8•23 years ago
|
||
sorry, I have to apply this diff to see the routines in context, but the
attachment is not an applyable diff, so I have to do it by hand. Bear with me,
please.
Comment 9•23 years ago
|
||
nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
at the end of this function, we should use your new mechanism of calling
OnCopyCompleted() now that it works w/o a copy state.
nsMsgLocalMailFolder::OnCopyCompleted(nsISupports *srcSupport, PRBool
moveCopySucceeded)
{
if (mCopyState)
{
delete mCopyState;
mCopyState = nsnull;
}
as in the imap case, no need to check null mCopyState here - delete is a noop
with a null pointer.
Other than that, it seems fine, modulo a lot of testing.
Comment 10•23 years ago
|
||
Comment on attachment 98526 [details] [diff] [review]
proposed fix
sr=bienvenu, but since there are about 5 outstanding changes, it would be nice
to have a new patch for whoever's r='ing. What I do when I have lots of changes
in my tree is do a whole diff, and edit out the files that aren't part of the
patch. It makes life easier if we need to try to take the patch to another
branch, for example.
Attachment #98526 -
Flags: superreview+
Assignee | ||
Comment 11•23 years ago
|
||
I understand but I have changes for other bug in the same file. I'll try to
attach a new patch.
Comment 12•23 years ago
|
||
unless the changes actually overlap on a line basis, you can remove diff
segments from the diffs in a particular file (if you're careful :-) )
Assignee | ||
Comment 13•23 years ago
|
||
that is what I did for last one.
Assignee | ||
Comment 14•23 years ago
|
||
Cavin, can yor r=? this patch. I have played w/ imap(cross-server,
offline),local, news and search for sometime now. everything looks ok.
Attachment #98526 -
Attachment is obsolete: true
Comment 15•23 years ago
|
||
Comment on attachment 98625 [details] [diff] [review]
patch w/ those minor changes
r=cavin.
Attachment #98625 -
Flags: review+
Assignee | ||
Comment 16•23 years ago
|
||
Comment on attachment 98625 [details] [diff] [review]
patch w/ those minor changes
carrying fwd sr=bienvenu
Attachment #98625 -
Flags: superreview+
Assignee | ||
Comment 17•23 years ago
|
||
tested compose also -> save as draft/template send copy and send later copying
to unsent messages for local and imap.
Assignee | ||
Comment 18•23 years ago
|
||
fix checked in. This fix could not make 1.2a so look out for dups.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 19•23 years ago
|
||
*** Bug 167590 has been marked as a duplicate of this bug. ***
Updated•23 years ago
|
QA Contact: gayatri → gchan
Comment 20•23 years ago
|
||
Navin or David,
Not sure what i should be testing? I see Navin's test
comment 17.
I assume testing cases that would generate an error mesg,
When dong a save or copy?
Assignee | ||
Comment 21•23 years ago
|
||
yes, testing more error-specific cases than normal ones.
Updated•20 years ago
|
Product: MailNews → Core
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
•