mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-29 19:20:36 +02:00
catch illegal date MONTH, see #646
This commit is contained in:
@@ -202,16 +202,7 @@ public class BluetoothOneByone extends BluetoothCommunication {
|
|||||||
try {
|
try {
|
||||||
dateTime.setLenient(false);
|
dateTime.setLenient(false);
|
||||||
scaleBtData.setDateTime(dateTime.getTime());
|
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.setFat(oneByoneLib.getBodyFat(weight, impedanceCoeff));
|
||||||
scaleBtData.setWater(oneByoneLib.getWater(scaleBtData.getFat()));
|
scaleBtData.setWater(oneByoneLib.getWater(scaleBtData.getFat()));
|
||||||
scaleBtData.setBone(oneByoneLib.getBoneMass(weight, impedanceValue));
|
scaleBtData.setBone(oneByoneLib.getBoneMass(weight, impedanceValue));
|
||||||
@@ -227,4 +218,14 @@ public class BluetoothOneByone extends BluetoothCommunication {
|
|||||||
|
|
||||||
addScaleMeasurement(scaleBtData);
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user