Merge pull request #2198 from jotomo/log-unhandled-exceptions-again

Log unhandled exceptions again
This commit is contained in:
Milos Kozak 2019-11-14 22:40:15 +01:00 committed by GitHub
commit c6bbc0fe8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 121 additions and 80 deletions

View file

@ -129,7 +129,14 @@ public class MainApp extends Application {
sConstraintsChecker = new ConstraintChecker();
sDatabaseHelper = OpenHelperManager.getHelper(sInstance, DatabaseHelper.class);
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> log.error("Uncaught exception crashing app", ex));
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> {
if (ex instanceof InternalError) {
// usually the app trying to spawn a thread while being killed
return;
}
log.error("Uncaught exception crashing app", ex);
});
try {
if (FabricPrivacy.fabricEnabled()) {

View file

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

View file

@ -10,8 +10,11 @@ import java.util.List;
import info.nightscout.androidaps.plugins.general.automation.actions.Action;
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger;
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AutomationEvent {
private static final Logger log = LoggerFactory.getLogger(AutomationEvent.class);
private Trigger trigger = new TriggerConnector();
private List<Action> actions = new ArrayList<>();
@ -74,7 +77,7 @@ public class AutomationEvent {
}
o.put("actions", array);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -91,7 +94,7 @@ public class AutomationEvent {
actions.add(Action.instantiate(new JSONObject(array.getString(i))));
}
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -11,6 +11,8 @@ import javax.annotation.Nullable;
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger;
import info.nightscout.androidaps.queue.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
Action ideas:
@ -44,6 +46,7 @@ import info.nightscout.androidaps.queue.Callback;
public abstract class Action {
private static final Logger log = LoggerFactory.getLogger(Action.class);
public Trigger precondition = null;
@ -65,7 +68,7 @@ public abstract class Action {
try {
o.put("type", this.getClass().getName());
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -84,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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return null;
}
@ -98,7 +101,7 @@ public abstract class Action {
fromJSON(data.toString());
}
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
}
}

View file

@ -18,8 +18,12 @@ import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithE
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.JsonHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActionLoopSuspend extends Action {
private static final Logger log = LoggerFactory.getLogger(ActionLoopSuspend.class);
public InputDuration minutes = new InputDuration(0, InputDuration.TimeUnit.MINUTES);
@Override
@ -59,7 +63,7 @@ public class ActionLoopSuspend extends Action {
o.put("type", this.getClass().getName());
o.put("data", data);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -70,7 +74,7 @@ public class ActionLoopSuspend extends Action {
JSONObject o = new JSONObject(data);
minutes.setMinutes(JsonHelper.safeGetInt(o, "minutes"));
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -20,8 +20,12 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.JsonHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActionNotification extends Action {
private static final Logger log = LoggerFactory.getLogger(ActionNotification.class);
public InputString text = new InputString();
@Override
@ -59,7 +63,7 @@ public class ActionNotification extends Action {
o.put("type", this.getClass().getName());
o.put("data", data);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -70,7 +74,7 @@ public class ActionNotification extends Action {
JSONObject o = new JSONObject(data);
text.setValue(JsonHelper.safeGetString(o, "text"));
} catch (JSONException e) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -19,8 +19,12 @@ import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuil
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerProfilePercent;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.JsonHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActionProfileSwitchPercent extends Action {
private static final Logger log = LoggerFactory.getLogger(ActionProfileSwitchPercent.class);
InputPercent pct = new InputPercent();
InputDuration duration = new InputDuration(0, InputDuration.TimeUnit.MINUTES);
@ -71,7 +75,7 @@ public class ActionProfileSwitchPercent extends Action {
data.put("durationInMinutes", duration.getMinutes());
o.put("data", data);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -83,7 +87,7 @@ public class ActionProfileSwitchPercent extends Action {
pct.setValue(JsonHelper.safeGetInt(d, "percentage"));
duration.setMinutes(JsonHelper.safeGetInt(d, "durationInMinutes"));
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -21,6 +21,7 @@ import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.JsonHelper;
public class ActionSendSMS extends Action {
private static final Logger log = LoggerFactory.getLogger(ActionSendSMS.class);
public InputString text = new InputString();
@ -56,7 +57,7 @@ public class ActionSendSMS extends Action {
o.put("type", this.getClass().getName());
o.put("data", data);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -67,7 +68,7 @@ public class ActionSendSMS extends Action {
JSONObject o = new JSONObject(data);
text.setValue(JsonHelper.safeGetString(o, "text"));
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -24,8 +24,12 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.JsonHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActionStartTempTarget extends Action {
private static final Logger log = LoggerFactory.getLogger(ActionStartTempTarget.class);
String reason = "";
InputTempTarget value = new InputTempTarget();
InputDuration duration = new InputDuration(0, InputDuration.TimeUnit.MINUTES);
@ -93,7 +97,7 @@ public class ActionStartTempTarget extends Action {
data.put("durationInMinutes", duration.getMinutes());
o.put("data", data);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -107,7 +111,7 @@ public class ActionStartTempTarget extends Action {
value.setValue(JsonHelper.safeGetDouble(d, "value"));
duration.setMinutes(JsonHelper.safeGetInt(d, "durationInMinutes"));
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -14,8 +14,12 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.JsonHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActionStopTempTarget extends Action {
private static final Logger log = LoggerFactory.getLogger(ActionStopTempTarget.class);
String reason = "";
private TempTarget tempTarget;
@ -54,7 +58,7 @@ public class ActionStopTempTarget extends Action {
data.put("reason", reason);
o.put("data", data);
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -65,7 +69,7 @@ public class ActionStopTempTarget extends Action {
JSONObject d = new JSONObject(data);
reason = JsonHelper.safeGetString(d, "reason");
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

@ -13,10 +13,13 @@ import com.google.common.base.Optional;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
public abstract class Trigger {
private static final Logger log = LoggerFactory.getLogger(Trigger.class);
TriggerConnector connector = null;
long lastRun;
@ -56,7 +59,7 @@ public abstract class Trigger {
try {
return instantiate(new JSONObject(json));
} catch (JSONException e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return null;
}
@ -69,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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return o.toString();
}
@ -179,7 +179,7 @@ public class TriggerConnector extends Trigger {
add(newItem);
}
} catch (JSONException e) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return this;
}

View file

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

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
*/
public class Encoding4b6bLoop extends Encoding4b6bAbstract {
private static final Logger log = LoggerFactory.getLogger(Encoding4b6bLoop.class);
public static final Logger LOG = LoggerFactory.getLogger(Encoding4b6bLoop.class);
public Map<Integer, Byte> codesRev = null;
@ -108,9 +109,8 @@ public class Encoding4b6bLoop extends Encoding4b6bAbstract {
int index2 = ((bitAccumulator >> (availBits - 12)) & 0b111111);
hiNibble = codesRev.get((bitAccumulator >> (availBits - 6)));
loNibble = codesRev.get(((bitAccumulator >> (availBits - 12)) & 0b111111));
} catch (Exception ex) {
System.out.println("Exception: " + ex.getMessage());
ex.printStackTrace();
} catch (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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
}
} else {

View file

@ -4,11 +4,15 @@ import android.annotation.TargetApi;
import android.os.Build;
import com.cozmo.danar.util.BleCommandUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.charset.StandardCharsets;
import java.util.Date;
public class DanaRS_Packet {
private static final Logger log = LoggerFactory.getLogger(DanaRS_Packet.class);
protected static final int TYPE_START = 0;
protected static final int OPCODE_START = 1;
protected static final int DATA_START = 2;
@ -73,7 +77,7 @@ public class DanaRS_Packet {
return ret;
} catch (Exception e) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
return null;
}

View file

@ -551,7 +551,7 @@ public class BLEComm {
break;
}
} catch (Exception e) {
e.printStackTrace();
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);
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
}

View file

@ -3,8 +3,11 @@ package info.nightscout.androidaps.plugins.pump.insight.app_layer.history.histor
import info.nightscout.androidaps.plugins.pump.insight.ids.HistoryEventIDs;
import info.nightscout.androidaps.plugins.pump.insight.utils.BOCUtil;
import info.nightscout.androidaps.plugins.pump.insight.utils.ByteBuf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HistoryEvent implements Comparable<HistoryEvent> {
private static final Logger log = LoggerFactory.getLogger(HistoryEvent.class);
private int eventYear;
private int eventMonth;
@ -22,10 +25,8 @@ public class HistoryEvent implements Comparable<HistoryEvent> {
else {
try {
event = eventClass.newInstance();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException | InstantiationException e) {
log.error("Unhandled exception", e);
}
}
event.parseHeader(byteBuf);

View file

@ -67,7 +67,6 @@ import info.nightscout.androidaps.utils.SP;
// All things marked with "TODO: Fix db code" needs to be updated in new 2.5 database code
public class MedtronicHistoryData {
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
private List<PumpHistoryEntry> allHistory = null;
@ -523,7 +522,7 @@ public class MedtronicHistoryData {
data.put("eventType", event);
NSUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
e.printStackTrace();
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) {
e.printStackTrace();
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) {
e.printStackTrace();
log.error("Unhandled exception", e);
}
}
}

View file

@ -30,7 +30,7 @@ public class QuickWizardTest {
try {
array = new JSONArray("[" + data1 + "," + data2 + "]");
} catch (JSONException e) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(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) {
e.printStackTrace();
throw new RuntimeException(e);
}
return list;
}