Skip to content

Commit d169c91

Browse files
committed
Update libraries, fix new warnings
1 parent 6ea4160 commit d169c91

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

cayenne/src/main/java/nl/sikken/bertrik/cayenne/CayenneMessage.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ public CayenneMessage() {
2424
* are supported.
2525
*/
2626
public CayenneMessage(ECayennePayloadFormat format) {
27-
switch (format) {
28-
case DYNAMIC_SENSOR_PAYLOAD:
29-
case PACKED_SENSOR_PAYLOAD:
30-
break;
31-
default:
32-
throw new IllegalArgumentException("Payload format not supported: " + format);
33-
}
34-
this.format = format;
27+
this.format = switch (format) {
28+
case DYNAMIC_SENSOR_PAYLOAD -> format;
29+
case PACKED_SENSOR_PAYLOAD -> format;
30+
default -> throw new IllegalArgumentException("Payload format not supported: " + format);
31+
};
3532
}
3633

3734
/**
@@ -40,11 +37,12 @@ public CayenneMessage(ECayennePayloadFormat format) {
4037
* @param data the raw data
4138
* @throws CayenneException in case of a parsing problem
4239
*/
40+
@SuppressWarnings("StatementSwitchToExpressionSwitch")
4341
public void parse(byte[] data) throws CayenneException {
42+
CayenneItem item;
4443
ByteBuffer bb = ByteBuffer.wrap(data);
4544
int channel = 0;
4645
while (bb.hasRemaining()) {
47-
CayenneItem item;
4846
switch (format) {
4947
case DYNAMIC_SENSOR_PAYLOAD:
5048
item = CayenneItem.parse(bb);

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[versions]
2-
errorprone = "2.37.0"
2+
errorprone = "2.38.0"
33
jackson = "2.18.3"
44
jersey = "3.1.10"
5-
junit = "5.12.1"
6-
mockito = "5.16.1"
5+
junit = "5.12.2"
6+
mockito = "5.17.0"
77
retrofit = "2.11.0"
88
slf4j = "2.0.17"
99

sensor-data-bridge/src/main/java/nl/bertriksikken/loraforwarder/CommandHandler.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ void processResponse(TtnUplinkMessage uplink) {
5151
ByteBuffer bb = ByteBuffer.wrap(uplink.getRawPayload()).order(ByteOrder.BIG_ENDIAN);
5252

5353
int cmd = bb.get() & 0xFF;
54-
switch (cmd) {
55-
case 0:
56-
executor.execute(new CatchingRunnable(LOG, () -> handleWifiLocalisation(bb, uplink.getDevId())));
57-
break;
58-
default:
59-
LOG.warn("Unhandled command {}", cmd);
60-
break;
54+
if (cmd == 0) {
55+
executor.execute(new CatchingRunnable(LOG, () -> handleWifiLocalisation(bb, uplink.getDevId())));
56+
} else {
57+
LOG.warn("Unhandled command {}", cmd);
6158
}
6259
}
6360

sensor-data-bridge/src/main/java/nl/bertriksikken/loraforwarder/SensorDataBridge.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ private void messageReceived(TtnAppConfig appConfig, TtnUplinkMessage uplink) {
120120
}
121121

122122
// package-private to allow testing
123+
@SuppressWarnings("StatementSwitchToExpressionSwitch")
123124
SensorData decodeTtnMessage(DecoderConfig config, TtnUplinkMessage uplink) throws PayloadParseException {
124125
SensorData sensorData = new SensorData();
125126

0 commit comments

Comments
 (0)