Fix Java and Jetty deprecations (#10349)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-03-19 10:40:14 +01:00
committed by GitHub
parent 580f293766
commit fe0c35d22f
43 changed files with 98 additions and 80 deletions

View File

@@ -18,6 +18,7 @@ import static org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.Pac
import static org.openhab.binding.rfxcom.internal.messages.RFXComLighting2Message.Commands.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
import org.openhab.binding.rfxcom.internal.exceptions.RFXComUnsupportedChannelException;
@@ -155,7 +156,7 @@ public class RFXComLighting2Message extends RFXComDeviceMessageImpl<RFXComLighti
*/
public static int getDimLevelFromPercentType(PercentType pt) {
return pt.toBigDecimal().multiply(BigDecimal.valueOf(15))
.divide(PercentType.HUNDRED.toBigDecimal(), 0, BigDecimal.ROUND_UP).intValue();
.divide(PercentType.HUNDRED.toBigDecimal(), 0, RoundingMode.UP).intValue();
}
/**
@@ -168,7 +169,7 @@ public class RFXComLighting2Message extends RFXComDeviceMessageImpl<RFXComLighti
value = Math.min(value, 15);
return new PercentType(BigDecimal.valueOf(value).multiply(BigDecimal.valueOf(100))
.divide(BigDecimal.valueOf(15), 0, BigDecimal.ROUND_UP).intValue());
.divide(BigDecimal.valueOf(15), 0, RoundingMode.UP).intValue());
}
@Override

View File

@@ -17,6 +17,7 @@ import static org.openhab.binding.rfxcom.internal.messages.ByteEnumUtil.fromByte
import static org.openhab.binding.rfxcom.internal.messages.RFXComLighting5Message.SubType.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
@@ -216,7 +217,7 @@ public class RFXComLighting5Message extends RFXComDeviceMessageImpl<RFXComLighti
*/
public static int getDimLevelFromPercentType(PercentType pt) {
return pt.toBigDecimal().multiply(BigDecimal.valueOf(31))
.divide(PercentType.HUNDRED.toBigDecimal(), 0, BigDecimal.ROUND_UP).intValue();
.divide(PercentType.HUNDRED.toBigDecimal(), 0, RoundingMode.UP).intValue();
}
/**
@@ -229,7 +230,7 @@ public class RFXComLighting5Message extends RFXComDeviceMessageImpl<RFXComLighti
value = Math.min(value, 31);
return new PercentType(BigDecimal.valueOf(value).multiply(BigDecimal.valueOf(100))
.divide(BigDecimal.valueOf(31), 0, BigDecimal.ROUND_UP).intValue());
.divide(BigDecimal.valueOf(31), 0, RoundingMode.UP).intValue());
}
@Override

View File

@@ -12,8 +12,7 @@
*/
package org.openhab.binding.rfxcom.internal.messages;
import static java.math.BigDecimal.*;
import static java.math.RoundingMode.HALF_DOWN;
import static java.math.RoundingMode.*;
import static org.openhab.binding.rfxcom.internal.RFXComBindingConstants.*;
import static org.openhab.binding.rfxcom.internal.messages.ByteEnumUtil.fromByte;
@@ -257,12 +256,12 @@ public class RFXComRFXSensorMessage extends RFXComDeviceMessageImpl<RFXComRFXSen
BigDecimal supplyVoltage = ((DecimalType) referenceVoltageState).toBigDecimal();
// RH = (((A/D voltage / supply voltage) - 0.16) / 0.0062) / (1.0546 - 0.00216 * temperature)
BigDecimal belowTheDivider = adVoltage.divide(supplyVoltage, 4, ROUND_HALF_DOWN)
.subtract(HUMIDITY_VOLTAGE_SUBTRACTION).divide(HUMIDITY_VOLTAGE_DIVIDER, 4, ROUND_HALF_DOWN);
BigDecimal belowTheDivider = adVoltage.divide(supplyVoltage, 4, HALF_DOWN)
.subtract(HUMIDITY_VOLTAGE_SUBTRACTION).divide(HUMIDITY_VOLTAGE_DIVIDER, 4, HALF_DOWN);
BigDecimal underTheDivider = HUMIDITY_TEMPERATURE_CORRECTION
.subtract(HUMIDITY_TEMPERATURE_MULTIPLIER.multiply(temperature));
return new DecimalType(belowTheDivider.divide(underTheDivider, 4, ROUND_HALF_DOWN));
return new DecimalType(belowTheDivider.divide(underTheDivider, 4, HALF_DOWN));
}
private State handlePressure(DeviceState deviceState) {
@@ -277,14 +276,14 @@ public class RFXComRFXSensorMessage extends RFXComDeviceMessageImpl<RFXComRFXSen
// hPa = ((A/D voltage / supply voltage) + 0.095) / 0.0009
return new DecimalType((adVoltage.divide(supplyVoltage, 4, HALF_DOWN).add(PRESSURE_ADDITION))
.divide(PRESSURE_DIVIDER, 4, ROUND_HALF_DOWN));
.divide(PRESSURE_DIVIDER, 4, HALF_DOWN));
}
private BigDecimal getVoltage() {
if (miliVoltageTimesTen == null) {
return null;
}
return miliVoltageTimesTen.divide(ONE_HUNDRED, 100, ROUND_CEILING);
return miliVoltageTimesTen.divide(ONE_HUNDRED, 100, CEILING);
}
@Override