Added catch for null pointer exception - fixes #61
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
OpenSeizureDetector Android App - Change Log
|
OpenSeizureDetector Android App - Change Log
|
||||||
============================================
|
============================================
|
||||||
V4.0.7 - Improvements to Data Sharing data log manager screen
|
V4.0.7 - Improvements to Data Sharing data log manager screen
|
||||||
|
- Removed automatic refresh of shared data events list (Issue #62)
|
||||||
|
- Added option to include warnings in shared data events list (Issue #64)
|
||||||
|
- Added catch of NullPointerException in LogManager in case of network disruption (Issue #61)
|
||||||
V4.0.6 - fixed issue with O2sat data not being recorded to database
|
V4.0.6 - fixed issue with O2sat data not being recorded to database
|
||||||
V4.0.5 - Added support for 3D data logging
|
V4.0.5 - Added support for 3D data logging
|
||||||
- Fixed issue with seizure reporting crashing if quotation marks included in text.
|
- Fixed issue with seizure reporting crashing if quotation marks included in text.
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ public class LogManager {
|
|||||||
c.moveToNext();
|
c.moveToNext();
|
||||||
dataPointArray.put(i, datapoint);
|
dataPointArray.put(i, datapoint);
|
||||||
i++;
|
i++;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException | NullPointerException e) {
|
||||||
Log.e(TAG, "cursor2Json(): error creating JSON Object");
|
Log.e(TAG, "cursor2Json(): error creating JSON Object");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ public class LogManager {
|
|||||||
c.moveToNext();
|
c.moveToNext();
|
||||||
eventsArray.put(i, event);
|
eventsArray.put(i, event);
|
||||||
i++;
|
i++;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException | NullPointerException e) {
|
||||||
Log.e(TAG, "eventCursor2Json(): error creating JSON Object");
|
Log.e(TAG, "eventCursor2Json(): error creating JSON Object");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -894,7 +894,7 @@ public class LogManager {
|
|||||||
try {
|
try {
|
||||||
String dateStr = eventObj.getString("dataTime");
|
String dateStr = eventObj.getString("dataTime");
|
||||||
eventDate = mUtil.string2date(dateStr);
|
eventDate = mUtil.string2date(dateStr);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException | NullPointerException e) {
|
||||||
Log.e(TAG, "createEventCallback() - Error parsing JSONObject: " + eventObj.toString());
|
Log.e(TAG, "createEventCallback() - Error parsing JSONObject: " + eventObj.toString());
|
||||||
finishUpload();
|
finishUpload();
|
||||||
return;
|
return;
|
||||||
@@ -914,6 +914,7 @@ public class LogManager {
|
|||||||
//Log.v(TAG, "createEventCallback() - datapointsJsonStr=" + datapointsJsonStr);
|
//Log.v(TAG, "createEventCallback() - datapointsJsonStr=" + datapointsJsonStr);
|
||||||
JSONArray dataObj;
|
JSONArray dataObj;
|
||||||
mDatapointsToUploadList = new ArrayList<JSONObject>();
|
mDatapointsToUploadList = new ArrayList<JSONObject>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
//DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
dataObj = new JSONArray(datapointsJsonStr);
|
dataObj = new JSONArray(datapointsJsonStr);
|
||||||
@@ -921,7 +922,7 @@ public class LogManager {
|
|||||||
for (int i = 0; i < dataObj.length(); i++) {
|
for (int i = 0; i < dataObj.length(); i++) {
|
||||||
mDatapointsToUploadList.add(dataObj.getJSONObject(i));
|
mDatapointsToUploadList.add(dataObj.getJSONObject(i));
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException | NullPointerException e) {
|
||||||
Log.v(TAG, "createEventCallback(): Error Creating JSON Object from string " + datapointsJsonStr);
|
Log.v(TAG, "createEventCallback(): Error Creating JSON Object from string " + datapointsJsonStr);
|
||||||
dataObj = null;
|
dataObj = null;
|
||||||
finishUpload();
|
finishUpload();
|
||||||
@@ -952,7 +953,7 @@ public class LogManager {
|
|||||||
mUploadInProgress = true;
|
mUploadInProgress = true;
|
||||||
try {
|
try {
|
||||||
mCurrentDatapointId = mDatapointsToUploadList.get(0).getInt("id");
|
mCurrentDatapointId = mDatapointsToUploadList.get(0).getInt("id");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException | NullPointerException e) {
|
||||||
Log.e(TAG, "uploadNextDatapoint(): Error reading currentDatapointID from mDatapointsToUploadList[0]" + e.getMessage());
|
Log.e(TAG, "uploadNextDatapoint(): Error reading currentDatapointID from mDatapointsToUploadList[0]" + e.getMessage());
|
||||||
Log.e(TAG, "uploadNextDatapoint(): Removing mDatapointsToUploadList[0] and trying the next datapoint");
|
Log.e(TAG, "uploadNextDatapoint(): Removing mDatapointsToUploadList[0] and trying the next datapoint");
|
||||||
mDatapointsToUploadList.remove(0);
|
mDatapointsToUploadList.remove(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user