aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/VltProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-07-07 07:33:16 -0700
committerAnton Tananaev <anton@traccar.org>2024-07-07 07:33:16 -0700
commitd0536ccbc1b7234784c5e48288bbac00a60ef821 (patch)
tree29ba8e1349eb9a5990f564edad7ddc7b5e24d7f7 /src/main/java/org/traccar/protocol/VltProtocolDecoder.java
parent864872b2df3e26c94d3a5826f4df504de3cf6c62 (diff)
downloadtrackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.gz
trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.bz2
trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.zip
Update switch statements
Diffstat (limited to 'src/main/java/org/traccar/protocol/VltProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/VltProtocolDecoder.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/VltProtocolDecoder.java b/src/main/java/org/traccar/protocol/VltProtocolDecoder.java
index 01c0563f5..40fb5eef7 100644
--- a/src/main/java/org/traccar/protocol/VltProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/VltProtocolDecoder.java
@@ -121,19 +121,18 @@ public class VltProtocolDecoder extends BaseHttpProtocolDecoder {
sendResponse(channel, HttpResponseStatus.OK);
- switch (type) {
- case "NRM":
- return decodePosition(deviceSession, sentence.substring(3 + 15));
- case "BTH":
+ return switch (type) {
+ case "NRM" -> decodePosition(deviceSession, sentence.substring(3 + 15));
+ case "BTH" -> {
List<Position> positions = new LinkedList<>();
int count = Integer.parseInt(sentence.substring(index, index += 3));
for (int i = 0; i < count; i++) {
positions.add(decodePosition(deviceSession, sentence.substring(index, index += 78)));
}
- return positions;
- default:
- return null;
- }
+ yield positions;
+ }
+ default -> null;
+ };
}
}