Log unhandled exceptions as errors.

This commit is contained in:
Johannes Mockenhaupt 2019-11-14 13:57:57 +01:00
parent dc38615ec9
commit b9d600edf4
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
39 changed files with 73 additions and 73 deletions

View file

@ -247,7 +247,7 @@ public class APSResult {
}
}
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return array;
}
@ -280,7 +280,7 @@ public class APSResult {
}
}
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return latest;

View file

@ -77,7 +77,7 @@ public class AutomationEvent {
}
o.put("actions", array);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -94,7 +94,7 @@ public class AutomationEvent {
actions.add(Action.instantiate(new JSONObject(array.getString(i))));
}
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -68,7 +68,7 @@ public abstract class Action {
try {
o.put("type", this.getClass().getName());
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -87,7 +87,7 @@ public abstract class Action {
Class clazz = Class.forName(type);
return ((Action) clazz.newInstance()).fromJSON(data != null ? data.toString() : "");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return null;
}
@ -101,7 +101,7 @@ public abstract class Action {
fromJSON(data.toString());
}
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}
}

View file

@ -63,7 +63,7 @@ public class ActionLoopSuspend extends Action {
o.put("type", this.getClass().getName());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -74,7 +74,7 @@ public class ActionLoopSuspend extends Action {
JSONObject o = new JSONObject(data);
minutes.setMinutes(JsonHelper.safeGetInt(o, "minutes"));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -63,7 +63,7 @@ public class ActionNotification extends Action {
o.put("type", this.getClass().getName());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -74,7 +74,7 @@ public class ActionNotification extends Action {
JSONObject o = new JSONObject(data);
text.setValue(JsonHelper.safeGetString(o, "text"));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -92,7 +92,7 @@ public class ActionProfileSwitch extends Action {
data.put("profileToSwitchTo", inputProfileName.getValue());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -105,7 +105,7 @@ public class ActionProfileSwitch extends Action {
profileName = JsonHelper.safeGetString(d, "profileToSwitchTo");
inputProfileName.setValue(profileName);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -75,7 +75,7 @@ public class ActionProfileSwitchPercent extends Action {
data.put("durationInMinutes", duration.getMinutes());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -87,7 +87,7 @@ public class ActionProfileSwitchPercent extends Action {
pct.setValue(JsonHelper.safeGetInt(d, "percentage"));
duration.setMinutes(JsonHelper.safeGetInt(d, "durationInMinutes"));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -57,7 +57,7 @@ public class ActionSendSMS extends Action {
o.put("type", this.getClass().getName());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -68,7 +68,7 @@ public class ActionSendSMS extends Action {
JSONObject o = new JSONObject(data);
text.setValue(JsonHelper.safeGetString(o, "text"));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -97,7 +97,7 @@ public class ActionStartTempTarget extends Action {
data.put("durationInMinutes", duration.getMinutes());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -111,7 +111,7 @@ public class ActionStartTempTarget extends Action {
value.setValue(JsonHelper.safeGetDouble(d, "value"));
duration.setMinutes(JsonHelper.safeGetInt(d, "durationInMinutes"));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -58,7 +58,7 @@ public class ActionStopTempTarget extends Action {
data.put("reason", reason);
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -69,7 +69,7 @@ public class ActionStopTempTarget extends Action {
JSONObject d = new JSONObject(data);
reason = JsonHelper.safeGetString(d, "reason");
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -59,7 +59,7 @@ public abstract class Trigger {
try {
return instantiate(new JSONObject(json));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return null;
}
@ -72,7 +72,7 @@ public abstract class Trigger {
Class clazz = Class.forName(type);
return ((Trigger) clazz.newInstance()).fromJSON(data.toString());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return null;
}

View file

@ -89,7 +89,7 @@ public class TriggerAutosensValue extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -102,7 +102,7 @@ public class TriggerAutosensValue extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -104,7 +104,7 @@ public class TriggerBg extends Trigger {
data.put("units", bg.getUnits());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -118,7 +118,7 @@ public class TriggerBg extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -86,7 +86,7 @@ public class TriggerBolusAgo extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -99,7 +99,7 @@ public class TriggerBolusAgo extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -87,7 +87,7 @@ public class TriggerCOB extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -100,7 +100,7 @@ public class TriggerCOB extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -162,7 +162,7 @@ public class TriggerConnector extends Trigger {
data.put("triggerList", array);
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -179,7 +179,7 @@ public class TriggerConnector extends Trigger {
add(newItem);
}
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -129,7 +129,7 @@ public class TriggerDelta extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -144,7 +144,7 @@ public class TriggerDelta extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -82,7 +82,7 @@ public class TriggerIob extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -95,7 +95,7 @@ public class TriggerIob extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -93,7 +93,7 @@ public class TriggerLocation extends Trigger {
data.put("lastRun", lastRun);
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -108,7 +108,7 @@ public class TriggerLocation extends Trigger {
name.setValue(JsonHelper.safeGetString(d, "name"));
lastRun = JsonHelper.safeGetLong(d, "lastRun");
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -88,7 +88,7 @@ public class TriggerProfilePercent extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -101,7 +101,7 @@ public class TriggerProfilePercent extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -82,7 +82,7 @@ public class TriggerPumpLastConnection extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -95,7 +95,7 @@ public class TriggerPumpLastConnection extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -163,7 +163,7 @@ public class TriggerRecurringTime extends Trigger {
object.put("type", TriggerRecurringTime.class.getName());
object.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return object.toString();
}
@ -181,7 +181,7 @@ public class TriggerRecurringTime extends Trigger {
minute = JsonHelper.safeGetInt(o, "minute");
validTo = JsonHelper.safeGetLong(o, "validTo");
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -74,7 +74,7 @@ public class TriggerTempTarget extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -86,7 +86,7 @@ public class TriggerTempTarget extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(ComparatorExists.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -65,7 +65,7 @@ public class TriggerTime extends Trigger {
object.put("type", TriggerTime.class.getName());
object.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return object.toString();
}
@ -78,7 +78,7 @@ public class TriggerTime extends Trigger {
lastRun = JsonHelper.safeGetLong(o, "lastRun");
runAt = JsonHelper.safeGetLong(o, "runAt");
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -93,7 +93,7 @@ public class TriggerTimeRange extends Trigger {
object.put("type", TriggerTimeRange.class.getName());
object.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
log.debug(object.toString());
return object.toString();
@ -108,7 +108,7 @@ public class TriggerTimeRange extends Trigger {
start = JsonHelper.safeGetInt(o, "start");
end = JsonHelper.safeGetInt(o, "end");
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -85,7 +85,7 @@ public class TriggerWifiSsid extends Trigger {
data.put("comparator", comparator.getValue().toString());
o.put("data", data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -98,7 +98,7 @@ public class TriggerWifiSsid extends Trigger {
lastRun = JsonHelper.safeGetLong(d, "lastRun");
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -594,7 +594,7 @@ public class NSUpload {
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}

View file

@ -110,7 +110,7 @@ public class Encoding4b6bLoop extends Encoding4b6bAbstract {
hiNibble = codesRev.get((bitAccumulator >> (availBits - 6)));
loNibble = codesRev.get(((bitAccumulator >> (availBits - 12)) & 0b111111));
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
return null;
}

View file

@ -383,7 +383,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
try {
o.wait();
} catch (InterruptedException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}
} else {

View file

@ -77,7 +77,7 @@ public class DanaRS_Packet {
return ret;
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return null;
}

View file

@ -551,7 +551,7 @@ public class BLEComm {
break;
}
} catch (Exception e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
startSignatureFound = false;
packetIsValid = false;
@ -635,7 +635,7 @@ public class BLEComm {
message.wait(5000);
} catch (InterruptedException e) {
log.error("sendMessage InterruptedException", e);
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}

View file

@ -1526,7 +1526,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
data.put("notes", note);
NSUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}
@ -1554,7 +1554,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
data.put("eventType", event);
NSUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}

View file

@ -26,7 +26,7 @@ public class HistoryEvent implements Comparable<HistoryEvent> {
try {
event = eventClass.newInstance();
} catch (IllegalAccessException | InstantiationException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}
event.parseHeader(byteBuf);

View file

@ -522,7 +522,7 @@ public class MedtronicHistoryData {
data.put("eventType", event);
NSUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
LOG.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}

View file

@ -133,7 +133,7 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
try {
getDao().executeRaw("ALTER TABLE `" + Treatment.TABLE_TREATMENTS + "` ADD COLUMN boluscalc STRING;");
} catch (SQLException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
} else {
if (L.isEnabled(L.DATATREATMENTS))
@ -147,7 +147,7 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
try {
getDao().executeRaw("ALTER TABLE `" + Treatment.TABLE_TREATMENTS + "` DROP COLUMN boluscalc STRING;");
} catch (SQLException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}
}

View file

@ -30,7 +30,7 @@ public class QuickWizardTest {
try {
array = new JSONArray("[" + data1 + "," + data2 + "]");
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
}

View file

@ -124,7 +124,7 @@ public class TriggerBgTest {
try {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":214,\"mills\":" + (now - 1) + ",\"direction\":\"Flat\"}"))));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}

View file

@ -152,7 +152,7 @@ public class TriggerDeltaTest {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":226,\"mills\":1514765100000,\"direction\":\"Flat\"}"))));
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":228,\"mills\":1514764800000,\"direction\":\"Flat\"}"))));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}

View file

@ -153,7 +153,7 @@ public class GlucoseStatusTest {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":226,\"mills\":1514765100000,\"direction\":\"Flat\"}"))));
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":228,\"mills\":1514764800000,\"direction\":\"Flat\"}"))));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}
@ -165,7 +165,7 @@ public class GlucoseStatusTest {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":216,\"mills\":1514766800000,\"direction\":\"Flat\"}")))); // +2
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":216,\"mills\":1514766600000,\"direction\":\"Flat\"}"))));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}
@ -180,7 +180,7 @@ public class GlucoseStatusTest {
try {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":228,\"mills\":1514764800000,\"direction\":\"Flat\"}"))));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}
@ -190,7 +190,7 @@ public class GlucoseStatusTest {
try {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":214,\"mills\":1514766900000,\"direction\":\"Flat\"}"))));
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}
@ -211,7 +211,7 @@ public class GlucoseStatusTest {
list.add(new BgReading(new NSSgv(new JSONObject("{\"mgdl\":" + (latest_reading + (i*2)) + ",\"mills\":" + (end_time - (1000 * 60 * i)) + ",\"direction\":\"Flat\"}"))));
}
} catch (JSONException e) {
log.debug("Unhandled exception", e);
log.error("Unhandled exception", e);
}
return list;
}