1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-29 02:59:57 +02:00

catch illegal date MONTH, see #646

This commit is contained in:
oliexdev
2020-11-25 20:11:18 +01:00
parent fb524fe01e
commit 0f89b42972

View File

@@ -202,16 +202,7 @@ public class BluetoothOneByone extends BluetoothCommunication {
try {
dateTime.setLenient(false);
scaleBtData.setDateTime(dateTime.getTime());
}
catch (IllegalArgumentException e) {
if (historicMeasurement) {
Timber.d("invalid time-stamp: year %d, month %d, day %d, hour %d, minute %d, second %d",
Converters.fromUnsignedInt16Be(weightBytes, 11),
weightBytes[13], weightBytes[14], weightBytes[15],
weightBytes[16], weightBytes[17]);
return; // discard historic measurement with invalid time-stamp
}
}
scaleBtData.setFat(oneByoneLib.getBodyFat(weight, impedanceCoeff));
scaleBtData.setWater(oneByoneLib.getWater(scaleBtData.getFat()));
scaleBtData.setBone(oneByoneLib.getBoneMass(weight, impedanceValue));
@@ -227,4 +218,14 @@ public class BluetoothOneByone extends BluetoothCommunication {
addScaleMeasurement(scaleBtData);
}
catch (IllegalArgumentException e) {
if (historicMeasurement) {
Timber.d("invalid time-stamp: year %d, month %d, day %d, hour %d, minute %d, second %d",
Converters.fromUnsignedInt16Be(weightBytes, 11),
weightBytes[13], weightBytes[14], weightBytes[15],
weightBytes[16], weightBytes[17]);
return; // discard historic measurement with invalid time-stamp
}
}
}
}