From 28238bd3142557aa6ff894f2cb9516c8b1af8e81 Mon Sep 17 00:00:00 2001 From: William Patterson Date: Sun, 16 Feb 2020 14:42:19 -0800 Subject: [PATCH 1/7] FORMAT file ADD docstrings ADD todos DELETE commented code --- Source/mesquite/trunk/PhoneHomeThread.java | 55 +++++++++++++++------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index 85a0d27f6..c9c94da8d 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -13,30 +13,51 @@ */ package mesquite.trunk; - -import java.io.IOException; import java.util.Vector; import org.apache.commons.httpclient.NameValuePair; -import mesquite.lib.*; +import mesquite.lib.AlertDialog; +import mesquite.lib.ListableVector; +import mesquite.lib.MesquiteFile; +import mesquite.lib.MesquiteInteger; +import mesquite.lib.MesquiteMessage; +import mesquite.lib.MesquiteModule; +import mesquite.lib.MesquiteModuleInfo; +import mesquite.lib.MesquiteThread; +import mesquite.lib.MesquiteTrunk; +import mesquite.lib.PhoneHomeRecord; +import mesquite.lib.PhoneHomeUtil; +import mesquite.lib.StringUtil; import mesquite.tol.lib.BaseHttpRequestMaker; -/* ======================================================================== */ +/** Phone Home to mesquite server. + * At thread startup, PhoneHomeThread will report the mesquite version to the + * Mesquite server. It will then proceed to query the mesquite server for any + * information about the installed module. + * + * After the initial startup, Phone Home thread will attempt to post any + * "beans" to the mesquite server every ten seconds + */ public class PhoneHomeThread extends Thread { + // TODO use generics Vector beans = new Vector(); + public PhoneHomeThread () { setPriority(Thread.MIN_PRIORITY); } + + @Override public void run() { - /*NOTICES =====Checking website to see if there are any notices or updates*/ - //Put here on a separate thread so Mesquite doesn't hang if website is unavailable + /* TODO Make this call non-blocking so the phone home thread does not + * hang if website is unavailable */ checkForMessagesFromAllHomes(); + // Report beans to the mesqutie server while (!MesquiteTrunk.mesquiteExiting) { try { Thread.sleep(1000); - if (beans.size()>0){ + if (beans.size() > 0) { NameValuePair[] b = (NameValuePair[])beans.elementAt(0); beans.removeElementAt(0); BaseHttpRequestMaker.sendInfoToServer(b, MesquiteModule.beansReportURL, null, 0); @@ -46,13 +67,16 @@ public void run() { } } } + public void postBean(NameValuePair[] pairs){ beans.addElement(pairs); } - /*.................................................................................................................*/ - public void checkForMessagesFromAllHomes(){ - //MesquiteTrunk.incrementMenuResetSuppression(); + /** Reports version to Mesquite server and checks for information about + * installed modules + */ + public void checkForMessagesFromAllHomes(){ + // Report Version to server try { if (!MesquiteTrunk.suppressVersionReporting){ StringBuffer response = new StringBuffer(); @@ -61,7 +85,6 @@ public void checkForMessagesFromAllHomes(){ buildNum = "PreRelease-" + buildNum; BaseHttpRequestMaker.contactServer(buildNum, MesquiteModule.versionReportURL, response); String r = response.toString(); - //if mq3rs is included in response, then this is real response if (!StringUtil.blank(r) && r.indexOf("mq3rs")>=0){ if (r.indexOf("mq3rsshow")>=0){ //show dialog at startup!!!! AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(),"Note", r, 600, 400, null); @@ -75,12 +98,13 @@ else if (MesquiteTrunk.debugMode) if (MesquiteTrunk.debugMode) MesquiteMessage.warnProgrammer("PROBLEM PHONING HOME to report version\n" + t.getCause()); } + + // Check Server for notice regarding the various installed modules ListableVector phoneRecords = new ListableVector(); StringBuffer notices = new StringBuffer(); StringBuffer logBuffer = new StringBuffer(); String path = MesquiteModule.prefsDirectory+ MesquiteFile.fileSeparator+ "phoneRecords.xml"; PhoneHomeUtil.readOldPhoneRecords(path, phoneRecords); - for (int i= 0; iFrom " + mmi.getName() + ""); notices.append(notice); - //notices.append("
"); } } catch (Throwable t){ } } } + + // Print Notices to console if (!StringUtil.blank(logBuffer.toString())){ MesquiteTrunk.mesquiteTrunk.logln("\n*************************" + logBuffer.toString() + "\n*************************\n"); } - if (!StringUtil.blank(notices)){ String note = ("

Notices from the websites of Mesquite and installed packages


" + notices.toString() + "

(You can ask Mesquite not to check for messages on its websites using the menu item in the Defaults submenu of the File menu)

"); if (!MesquiteThread.isScripting()){ @@ -131,10 +155,7 @@ else if (!StringUtil.blank(mmi.getPackageName())) PhoneHomeUtil.writePhoneRecords(path, phoneRecords); MesquiteTrunk.mesquiteTrunk.storePreferences(); MesquiteTrunk.resetAllMenuBars(); - - // MesquiteTrunk.decrementMenuResetSuppression(); } - } From b30d7f2c0a8a9f62c4ffe80129bdccfdc507a45c Mon Sep 17 00:00:00 2001 From: William Patterson Date: Sun, 16 Feb 2020 14:47:17 -0800 Subject: [PATCH 2/7] ADD todos --- Source/mesquite/trunk/PhoneHomeThread.java | 108 ++++++++++----------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index c9c94da8d..e9c5090b9 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -31,70 +31,71 @@ import mesquite.lib.StringUtil; import mesquite.tol.lib.BaseHttpRequestMaker; -/** Phone Home to mesquite server. - * At thread startup, PhoneHomeThread will report the mesquite version to the - * Mesquite server. It will then proceed to query the mesquite server for any - * information about the installed module. - * - * After the initial startup, Phone Home thread will attempt to post any - * "beans" to the mesquite server every ten seconds +/** + * Phone Home to mesquite server. At thread startup, PhoneHomeThread will report + * the mesquite version to the Mesquite server. It will then proceed to query + * the mesquite server for any information about the installed module. + * + * After the initial startup, Phone Home thread will attempt to post any "beans" + * to the mesquite server every ten seconds */ public class PhoneHomeThread extends Thread { // TODO use generics Vector beans = new Vector(); - public PhoneHomeThread () { + public PhoneHomeThread() { setPriority(Thread.MIN_PRIORITY); } @Override public void run() { - /* TODO Make this call non-blocking so the phone home thread does not - * hang if website is unavailable */ + /* + * TODO Make this call non-blocking so the phone home thread does not hang if + * website is unavailable + */ checkForMessagesFromAllHomes(); // Report beans to the mesqutie server - while (!MesquiteTrunk.mesquiteExiting) { + while (!MesquiteTrunk.mesquiteExiting) { try { Thread.sleep(1000); if (beans.size() > 0) { - NameValuePair[] b = (NameValuePair[])beans.elementAt(0); + NameValuePair[] b = (NameValuePair[]) beans.elementAt(0); beans.removeElementAt(0); BaseHttpRequestMaker.sendInfoToServer(b, MesquiteModule.beansReportURL, null, 0); } - } - catch (Throwable e){ + } catch (Throwable e) { } } } - public void postBean(NameValuePair[] pairs){ - beans.addElement(pairs); + public void postBean(NameValuePair[] pairs) { + beans.addElement(pairs); // TODO use generics } - /** Reports version to Mesquite server and checks for information about - * installed modules + /** + * Reports version to Mesquite server and checks for information about installed + * modules */ - public void checkForMessagesFromAllHomes(){ + public void checkForMessagesFromAllHomes() { // Report Version to server try { - if (!MesquiteTrunk.suppressVersionReporting){ + if (!MesquiteTrunk.suppressVersionReporting) { StringBuffer response = new StringBuffer(); String buildNum = Integer.toString(MesquiteTrunk.getBuildNumber()); if (MesquiteTrunk.mesquiteTrunk.isPrerelease()) buildNum = "PreRelease-" + buildNum; BaseHttpRequestMaker.contactServer(buildNum, MesquiteModule.versionReportURL, response); String r = response.toString(); - if (!StringUtil.blank(r) && r.indexOf("mq3rs")>=0){ - if (r.indexOf("mq3rsshow")>=0){ //show dialog at startup!!!! - AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(),"Note", r, 600, 400, null); + if (!StringUtil.blank(r) && r.indexOf("mq3rs") >= 0) { + if (r.indexOf("mq3rsshow") >= 0) { // show dialog at startup!!!! + AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(), "Note", r, 600, 400, + null); } - } - else if (MesquiteTrunk.debugMode) + } else if (MesquiteTrunk.debugMode) MesquiteMessage.warnProgrammer("no response or incorrect response from server on startup"); } - } - catch (Throwable t){ + } catch (Throwable t) { if (MesquiteTrunk.debugMode) MesquiteMessage.warnProgrammer("PROBLEM PHONING HOME to report version\n" + t.getCause()); } @@ -103,26 +104,26 @@ else if (MesquiteTrunk.debugMode) ListableVector phoneRecords = new ListableVector(); StringBuffer notices = new StringBuffer(); StringBuffer logBuffer = new StringBuffer(); - String path = MesquiteModule.prefsDirectory+ MesquiteFile.fileSeparator+ "phoneRecords.xml"; + String path = MesquiteModule.prefsDirectory + MesquiteFile.fileSeparator + "phoneRecords.xml"; PhoneHomeUtil.readOldPhoneRecords(path, phoneRecords); - for (int i= 0; iFrom " + mmi.getName() + ""); notices.append(notice); } - } - catch (Throwable t){ + } catch (Throwable t) { // TODO catch and handle errors explicitly } } } // Print Notices to console - if (!StringUtil.blank(logBuffer.toString())){ - MesquiteTrunk.mesquiteTrunk.logln("\n*************************" + logBuffer.toString() + "\n*************************\n"); + if (!StringUtil.blank(logBuffer.toString())) { + MesquiteTrunk.mesquiteTrunk + .logln("\n*************************" + logBuffer.toString() + "\n*************************\n"); } - if (!StringUtil.blank(notices)){ - String note = ("

Notices from the websites of Mesquite and installed packages


" + notices.toString() + "

(You can ask Mesquite not to check for messages on its websites using the menu item in the Defaults submenu of the File menu)

"); - if (!MesquiteThread.isScripting()){ - AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(),"Note", note, 600, 400, PhoneHomeUtil.getPhoneHomeDialogLinkCommand(), true); - } - else + if (!StringUtil.blank(notices)) { + String note = ("

Notices from the websites of Mesquite and installed packages


" + + notices.toString() + + "

(You can ask Mesquite not to check for messages on its websites using the menu item in the Defaults submenu of the File menu)

"); + if (!MesquiteThread.isScripting()) { + AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(), "Note", note, 600, 400, + PhoneHomeUtil.getPhoneHomeDialogLinkCommand(), true); + } else System.out.println(note); } - if (phoneRecords.size()>0) + if (phoneRecords.size() > 0) PhoneHomeUtil.writePhoneRecords(path, phoneRecords); MesquiteTrunk.mesquiteTrunk.storePreferences(); MesquiteTrunk.resetAllMenuBars(); } } - - - From ea084deec9cdabd8f192da2081af4351e3156d80 Mon Sep 17 00:00:00 2001 From: William Patterson Date: Sun, 16 Feb 2020 15:02:36 -0800 Subject: [PATCH 3/7] ADD generics and reduce nesting --- Source/mesquite/trunk/PhoneHomeThread.java | 73 +++++++++++----------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index e9c5090b9..763ac3507 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -40,8 +40,7 @@ * to the mesquite server every ten seconds */ public class PhoneHomeThread extends Thread { - // TODO use generics - Vector beans = new Vector(); + private Vector beans = new Vector(); public PhoneHomeThread() { setPriority(Thread.MIN_PRIORITY); @@ -55,27 +54,26 @@ public void run() { */ checkForMessagesFromAllHomes(); - // Report beans to the mesqutie server + // Report beans to the Mesqutie server while (!MesquiteTrunk.mesquiteExiting) { try { Thread.sleep(1000); if (beans.size() > 0) { - NameValuePair[] b = (NameValuePair[]) beans.elementAt(0); + BaseHttpRequestMaker.sendInfoToServer(beans.elementAt(0), MesquiteModule.beansReportURL, null, 0); beans.removeElementAt(0); - BaseHttpRequestMaker.sendInfoToServer(b, MesquiteModule.beansReportURL, null, 0); } - } catch (Throwable e) { + } catch (Throwable e) { // TODO Catch and handle } } } public void postBean(NameValuePair[] pairs) { - beans.addElement(pairs); // TODO use generics + beans.addElement(pairs); } /** - * Reports version to Mesquite server and checks for information about installed - * modules + * Reports version to Mesquite server and checks for information mesquite about + * installed modules */ public void checkForMessagesFromAllHomes() { // Report Version to server @@ -95,12 +93,13 @@ public void checkForMessagesFromAllHomes() { } else if (MesquiteTrunk.debugMode) MesquiteMessage.warnProgrammer("no response or incorrect response from server on startup"); } - } catch (Throwable t) { + } catch (Throwable t) { // TODO catch and handle if (MesquiteTrunk.debugMode) MesquiteMessage.warnProgrammer("PROBLEM PHONING HOME to report version\n" + t.getCause()); } - // Check Server for notice regarding the various installed modules + // Check Server for notice regarding the mesquite and the various installed + // modules ListableVector phoneRecords = new ListableVector(); StringBuffer notices = new StringBuffer(); StringBuffer logBuffer = new StringBuffer(); @@ -108,34 +107,34 @@ public void checkForMessagesFromAllHomes() { PhoneHomeUtil.readOldPhoneRecords(path, phoneRecords); for (int i = 0; i < MesquiteTrunk.mesquiteModulesInfoVector.size(); i++) { MesquiteModuleInfo mmi = (MesquiteModuleInfo) MesquiteTrunk.mesquiteModulesInfoVector.elementAt(i); - if (!StringUtil.blank(mmi.getHomePhoneNumber())) { - try { - int rec = phoneRecords.indexOfByName("#" + mmi.getClassName()); - if (MesquiteTrunk.debugMode) { - MesquiteTrunk.mesquiteTrunk - .logln("Checking server for notices regarding " + mmi.getPackageName()); - } + if (StringUtil.blank(mmi.getHomePhoneNumber())) { + continue; + } + try { + int rec = phoneRecords.indexOfByName("#" + mmi.getClassName()); + if (MesquiteTrunk.debugMode) { + MesquiteTrunk.mesquiteTrunk.logln("Checking server for notices regarding " + mmi.getPackageName()); + } - PhoneHomeRecord phoneHomeRecord; - if (!MesquiteInteger.isCombinable(rec) || rec < 0) {// this module is not the phone records - phoneHomeRecord = new PhoneHomeRecord("#" + mmi.getClassName()); - phoneRecords.addElement(phoneHomeRecord, false); - } else - phoneHomeRecord = (PhoneHomeRecord) phoneRecords.elementAt(rec); - String notice = PhoneHomeUtil.retrieveMessagesFromHome(mmi, phoneHomeRecord, logBuffer); - - phoneHomeRecord.setCurrentValues(mmi); - if (!StringUtil.blank(notice)) { - if (mmi.getModuleClass() == mesquite.Mesquite.class) - notices.append("

From Mesquite

"); - else if (!StringUtil.blank(mmi.getPackageName())) - notices.append("

From " + mmi.getPackageName() + "

"); - else - notices.append("

From " + mmi.getName() + "

"); - notices.append(notice); - } - } catch (Throwable t) { // TODO catch and handle errors explicitly + PhoneHomeRecord phoneHomeRecord; + if (!MesquiteInteger.isCombinable(rec) || rec < 0) {// this module is not the phone records + phoneHomeRecord = new PhoneHomeRecord("#" + mmi.getClassName()); + phoneRecords.addElement(phoneHomeRecord, false); + } else + phoneHomeRecord = (PhoneHomeRecord) phoneRecords.elementAt(rec); + String notice = PhoneHomeUtil.retrieveMessagesFromHome(mmi, phoneHomeRecord, logBuffer); + + phoneHomeRecord.setCurrentValues(mmi); + if (!StringUtil.blank(notice)) { + if (mmi.getModuleClass() == mesquite.Mesquite.class) + notices.append("

From Mesquite

"); + else if (!StringUtil.blank(mmi.getPackageName())) + notices.append("

From " + mmi.getPackageName() + "

"); + else + notices.append("

From " + mmi.getName() + "

"); + notices.append(notice); } + } catch (Throwable t) { // TODO catch and handle errors explicitly } } From 7d007032b7f0e388b718bdc361414cf224568b18 Mon Sep 17 00:00:00 2001 From: William Patterson Date: Sun, 16 Feb 2020 15:45:50 -0800 Subject: [PATCH 4/7] Flatten the reporting method and move code outside of try blocks --- Source/mesquite/trunk/PhoneHomeThread.java | 82 +++++++++++----------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index 763ac3507..894022899 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -77,25 +77,26 @@ public void postBean(NameValuePair[] pairs) { */ public void checkForMessagesFromAllHomes() { // Report Version to server - try { - if (!MesquiteTrunk.suppressVersionReporting) { - StringBuffer response = new StringBuffer(); - String buildNum = Integer.toString(MesquiteTrunk.getBuildNumber()); - if (MesquiteTrunk.mesquiteTrunk.isPrerelease()) - buildNum = "PreRelease-" + buildNum; + if (!MesquiteTrunk.suppressVersionReporting) { + StringBuffer response = new StringBuffer(); + String buildNum = Integer.toString(MesquiteTrunk.getBuildNumber()); + if (MesquiteTrunk.mesquiteTrunk.isPrerelease()) + buildNum = "PreRelease-" + buildNum; + + try { BaseHttpRequestMaker.contactServer(buildNum, MesquiteModule.versionReportURL, response); - String r = response.toString(); - if (!StringUtil.blank(r) && r.indexOf("mq3rs") >= 0) { - if (r.indexOf("mq3rsshow") >= 0) { // show dialog at startup!!!! - AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(), "Note", r, 600, 400, - null); - } - } else if (MesquiteTrunk.debugMode) - MesquiteMessage.warnProgrammer("no response or incorrect response from server on startup"); + } catch (Throwable t) { // TODO catch and handle + if (MesquiteTrunk.debugMode) + MesquiteMessage.warnProgrammer("PROBLEM PHONING HOME to report version\n" + t.getCause()); } - } catch (Throwable t) { // TODO catch and handle - if (MesquiteTrunk.debugMode) - MesquiteMessage.warnProgrammer("PROBLEM PHONING HOME to report version\n" + t.getCause()); + + String r = response.toString(); + if (!StringUtil.blank(r) && r.indexOf("mq3rs") >= 0) { + if (r.indexOf("mq3rsshow") >= 0) { // show dialog at startup!!!! + AlertDialog.noticeHTML(MesquiteTrunk.mesquiteTrunk.containerOfModule(), "Note", r, 600, 400, null); + } + } else if (MesquiteTrunk.debugMode) + MesquiteMessage.warnProgrammer("no response or incorrect response from server on startup"); } // Check Server for notice regarding the mesquite and the various installed @@ -110,32 +111,33 @@ public void checkForMessagesFromAllHomes() { if (StringUtil.blank(mmi.getHomePhoneNumber())) { continue; } - try { - int rec = phoneRecords.indexOfByName("#" + mmi.getClassName()); - if (MesquiteTrunk.debugMode) { - MesquiteTrunk.mesquiteTrunk.logln("Checking server for notices regarding " + mmi.getPackageName()); - } + int rec = phoneRecords.indexOfByName("#" + mmi.getClassName()); + if (MesquiteTrunk.debugMode) { + MesquiteTrunk.mesquiteTrunk.logln("Checking server for notices regarding " + mmi.getPackageName()); + } - PhoneHomeRecord phoneHomeRecord; - if (!MesquiteInteger.isCombinable(rec) || rec < 0) {// this module is not the phone records - phoneHomeRecord = new PhoneHomeRecord("#" + mmi.getClassName()); - phoneRecords.addElement(phoneHomeRecord, false); - } else - phoneHomeRecord = (PhoneHomeRecord) phoneRecords.elementAt(rec); - String notice = PhoneHomeUtil.retrieveMessagesFromHome(mmi, phoneHomeRecord, logBuffer); - - phoneHomeRecord.setCurrentValues(mmi); - if (!StringUtil.blank(notice)) { - if (mmi.getModuleClass() == mesquite.Mesquite.class) - notices.append("

From Mesquite

"); - else if (!StringUtil.blank(mmi.getPackageName())) - notices.append("

From " + mmi.getPackageName() + "

"); - else - notices.append("

From " + mmi.getName() + "

"); - notices.append(notice); - } + PhoneHomeRecord phoneHomeRecord; + if (!MesquiteInteger.isCombinable(rec) || rec < 0) {// this module is not the phone records + phoneHomeRecord = new PhoneHomeRecord("#" + mmi.getClassName()); + phoneRecords.addElement(phoneHomeRecord, false); + } else + phoneHomeRecord = (PhoneHomeRecord) phoneRecords.elementAt(rec); + + String notice = ""; + try { + notice = PhoneHomeUtil.retrieveMessagesFromHome(mmi, phoneHomeRecord, logBuffer); } catch (Throwable t) { // TODO catch and handle errors explicitly } + phoneHomeRecord.setCurrentValues(mmi); + if (!StringUtil.blank(notice)) { + if (mmi.getModuleClass() == mesquite.Mesquite.class) + notices.append("

From Mesquite

"); + else if (!StringUtil.blank(mmi.getPackageName())) + notices.append("

From " + mmi.getPackageName() + "

"); + else + notices.append("

From " + mmi.getName() + "

"); + notices.append(notice); + } } // Print Notices to console From 98ec0521c1a561f4bdd9addaed80a9a53212a825 Mon Sep 17 00:00:00 2001 From: William Patterson Date: Sun, 16 Feb 2020 15:58:54 -0800 Subject: [PATCH 5/7] Added handler for thread interruption so the thread dies when requested --- Source/mesquite/trunk/PhoneHomeThread.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index 894022899..ea77426ec 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -62,7 +62,11 @@ public void run() { BaseHttpRequestMaker.sendInfoToServer(beans.elementAt(0), MesquiteModule.beansReportURL, null, 0); beans.removeElementAt(0); } - } catch (Throwable e) { // TODO Catch and handle + } catch (InterruptedException e) { // Kill thread if Interrupted + MesquiteTrunk.mesquiteTrunk.logln("PhoneHomeThread was interrupted"); + e.printStackTrace(); + break; + } catch (Throwable e) { // TODO Catch and handle exceptions from BaseHttpRequestMaker } } } From f19cb82b9ca82a2a68eb8b071b2e538531a9f3ba Mon Sep 17 00:00:00 2001 From: William Patterson Date: Sun, 16 Feb 2020 16:26:12 -0800 Subject: [PATCH 6/7] typo --- Source/mesquite/trunk/PhoneHomeThread.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index ea77426ec..e396c86ef 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -76,8 +76,8 @@ public void postBean(NameValuePair[] pairs) { } /** - * Reports version to Mesquite server and checks for information mesquite about - * installed modules + * Reports version to Mesquite server and checks for information about mesquite + * and installed modules */ public void checkForMessagesFromAllHomes() { // Report Version to server From c0042acf2e77e3d265258856a2fce7f7f21162dc Mon Sep 17 00:00:00 2001 From: William Patterson Date: Tue, 18 Feb 2020 22:07:18 -0800 Subject: [PATCH 7/7] remove try catch completely because errors are handled in the --- Source/mesquite/trunk/PhoneHomeThread.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Source/mesquite/trunk/PhoneHomeThread.java b/Source/mesquite/trunk/PhoneHomeThread.java index e396c86ef..7f17525d6 100644 --- a/Source/mesquite/trunk/PhoneHomeThread.java +++ b/Source/mesquite/trunk/PhoneHomeThread.java @@ -66,8 +66,7 @@ public void run() { MesquiteTrunk.mesquiteTrunk.logln("PhoneHomeThread was interrupted"); e.printStackTrace(); break; - } catch (Throwable e) { // TODO Catch and handle exceptions from BaseHttpRequestMaker - } + } } } @@ -87,12 +86,7 @@ public void checkForMessagesFromAllHomes() { if (MesquiteTrunk.mesquiteTrunk.isPrerelease()) buildNum = "PreRelease-" + buildNum; - try { - BaseHttpRequestMaker.contactServer(buildNum, MesquiteModule.versionReportURL, response); - } catch (Throwable t) { // TODO catch and handle - if (MesquiteTrunk.debugMode) - MesquiteMessage.warnProgrammer("PROBLEM PHONING HOME to report version\n" + t.getCause()); - } + BaseHttpRequestMaker.contactServer(buildNum, MesquiteModule.versionReportURL, response); String r = response.toString(); if (!StringUtil.blank(r) && r.indexOf("mq3rs") >= 0) { @@ -128,10 +122,7 @@ public void checkForMessagesFromAllHomes() { phoneHomeRecord = (PhoneHomeRecord) phoneRecords.elementAt(rec); String notice = ""; - try { - notice = PhoneHomeUtil.retrieveMessagesFromHome(mmi, phoneHomeRecord, logBuffer); - } catch (Throwable t) { // TODO catch and handle errors explicitly - } + notice = PhoneHomeUtil.retrieveMessagesFromHome(mmi, phoneHomeRecord, logBuffer); phoneHomeRecord.setCurrentValues(mmi); if (!StringUtil.blank(notice)) { if (mmi.getModuleClass() == mesquite.Mesquite.class)