Closed Bug 240821 Opened 20 years ago Closed 20 years ago

Remove unneeded try+catch associated to |smtpService|

Categories

(SeaMonkey :: MailNews: Account Configuration, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8alpha1

People

(Reporter: sgautherie, Assigned: sgautherie)

References

()

Details

Attachments

(4 obsolete files)

While working on bug 237448,
I noticed that |smtpService.*| is used both within or without try+catch,
which seems inconsistent.

Since there is no complain on the 'without' cases,
I assume that the 'within' cases are "over-protected".
Assignee: sspitzer → gautheri
Status: NEW → ASSIGNED
Comment on attachment 146377 [details] [diff] [review]
(Av1) <am-smtp.js>
[Checked in: Comment 4]


I propose this patch as a first case;
if you r+ it, I'll post other patch(es) for the few other files;
if you r- it, tell me if more try+catch are needed, (or what).
Attachment #146377 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 146377 [details] [diff] [review]
(Av1) <am-smtp.js>
[Checked in: Comment 4]

Yes, it looks like defaultServer always succeeds (well an extreme memory
corruption could cause it to fail...)
Attachment #146377 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #146377 - Flags: superreview?(mscott)
Attachment #146377 - Flags: superreview?(mscott) → superreview+
Comment on attachment 146377 [details] [diff] [review]
(Av1) <am-smtp.js>
[Checked in: Comment 4]


Check in: { 2004-04-29 03:17	neil%parkwaycc.co.uk	mozilla/ mailnews/
base/ prefs/ resources/ content/ am-smtp.js  1.13 }
Attachment #146377 - Attachment description: (Av1) <am-smtp.js> → (Av1) <am-smtp.js> [Checked in: Comment 4]
Attachment #146377 - Attachment is obsolete: true
Attached patch (Bv1-r) <*.js> (for review only) (obsolete) — Splinter Review
Comment on attachment 147357 [details] [diff] [review]
(Bv1-r)  <*.js> (for review only)


Could you test/review this patch ? Thanks.
Attachment #147357 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 147357 [details] [diff] [review]
(Bv1-r)  <*.js> (for review only)

>-      try {element["serverkey"] = smtpService.defaultServer.key;}
>-      catch(ex){}
>+      element["serverkey"] = smtpService.defaultServer.key;
It's just possible that smtpService.defaultServer might be null here, so you
can't be sure that there is a default key.

>-    try {
>         if (!smtpServer) {
>             smtpServer = smtpService.createSmtpServer();
>             window.arguments[0].addSmtpServer = smtpServer.key;
>         }
>         
>+  try {
It's not worth moving this. In fact createSmtpServer might just fail.

>         // can't delete default server
>         var server = getSelectedServer();
>-        try{
>           if (smtpService.defaultServer == server) {
>               dump("Selected default server!\n");
>               setDefaultButton.setAttribute("disabled", "true");
>@@ -146,7 +146,6 @@ function updateButtons()
>               setDefaultButton.removeAttribute("disabled");
>               deleteButton.removeAttribute("disabled");
>           }
>-        } catch(ex){}
It would have been nice to see all the context here (try -u4 or -u5) just to
check that the missing lines are what I'm guessing they are.

>-          try{
>             var smtpServer = parent.smtpService.defaultServer;
>             smtpServerName = pageData.server.smtphostname.value;
>             if (!smtpServerName && smtpServer.hostname)
>                 smtpServerName = smtpServer.hostname;
>-          } catch(ex){}
Again, the defaultServer might possibly be null.

>-  try {
>     // don't use the default smtp server if it has a redirector type
>     if (!parent.smtpService.defaultServer.redirectorType) {
>       smtpServer = parent.smtpService.defaultServer;
>       setPageData(pageData, "identity", "smtpServerKey", smtpServer.key);
>     }
>-  }
>-  catch(ex){}
I think defaultServer could be null here to.
Attachment #147357 - Flags: review?(neil.parkwaycc.co.uk) → review-
Bv1-r, with comment 7 suggestion(s).
Attachment #147357 - Attachment is obsolete: true
Comment on attachment 147489 [details] [diff] [review]
(Bv2-r)  <*.js> (for review only)
[Check in: See Bv2-ci]


Could you test/review this patch ? Thanks.
Attachment #147489 - Flags: review?
Comment on attachment 147489 [details] [diff] [review]
(Bv2-r)  <*.js> (for review only)
[Check in: See Bv2-ci]


Could you test/review this patch ? Thanks.
Attachment #147489 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #147489 - Flags: review?
Comment on attachment 147489 [details] [diff] [review]
(Bv2-r)  <*.js> (for review only)
[Check in: See Bv2-ci]

This looks ok as far as I can tell for a -w diff although some of your
reindentations look suspicious.
Attachment #147489 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #147489 - Flags: superreview?(Henry.Jia)
Comment on attachment 147489 [details] [diff] [review]
(Bv2-r)  <*.js> (for review only)
[Check in: See Bv2-ci]

No super-review from <Henry.Jia@sun.com> since "2004-05-09" :-(
Attachment #147489 - Flags: superreview?(Henry.Jia) → superreview?(mscott)
Attachment #147489 - Flags: superreview?(mscott) → superreview+
Bv2-r, with white space differences.
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Attachment #149224 - Attachment description: (Bv2-ci) <*.js> (for check in) → (Bv2-ci) <*.js> (for check in) [Checked in: Comment 14]
Attachment #149224 - Attachment is obsolete: true
Attachment #147489 - Attachment description: (Bv2-r) <*.js> (for review only) → (Bv2-r) <*.js> (for review only) [Check in: See Bv2-ci]
Attachment #147489 - Attachment is obsolete: true
Target Milestone: --- → mozilla1.8alpha
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: