aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/WatchFrameDecoder.java
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
committerIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
commit55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch)
treeb86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/WatchFrameDecoder.java
parentc04ad7d48331253c095fc123ded1b00f6ff871d3 (diff)
parent2788174193def918a3a1a5be3bbed24c9613323f (diff)
downloadtrackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.gz
trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.bz2
trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.zip
Merge tag 'tags/v6.3'
Diffstat (limited to 'src/main/java/org/traccar/protocol/WatchFrameDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/WatchFrameDecoder.java35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchFrameDecoder.java b/src/main/java/org/traccar/protocol/WatchFrameDecoder.java
index 9dfae8726..992cb02ab 100644
--- a/src/main/java/org/traccar/protocol/WatchFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/WatchFrameDecoder.java
@@ -32,14 +32,8 @@ public class WatchFrameDecoder extends BaseFrameDecoder {
for (int i = buf.readerIndex(); i < buf.writerIndex(); i++) {
byte b = buf.getByte(i);
switch (b) {
- case '[':
- brackets += 1;
- break;
- case ']':
- brackets -= 1;
- break;
- default:
- break;
+ case '[' -> brackets += 1;
+ case ']' -> brackets -= 1;
}
if (brackets == 0 && i > buf.readerIndex()) {
endIndex = i + 1;
@@ -54,24 +48,13 @@ public class WatchFrameDecoder extends BaseFrameDecoder {
if (b1 == '}') {
byte b2 = buf.readByte();
switch (b2) {
- case 0x01:
- frame.writeByte('}');
- break;
- case 0x02:
- frame.writeByte('[');
- break;
- case 0x03:
- frame.writeByte(']');
- break;
- case 0x04:
- frame.writeByte(',');
- break;
- case 0x05:
- frame.writeByte('*');
- break;
- default:
- throw new IllegalArgumentException(String.format(
- "unexpected byte at %d: 0x%02x", buf.readerIndex() - 1, b2));
+ case 0x01 -> frame.writeByte('}');
+ case 0x02 -> frame.writeByte('[');
+ case 0x03 -> frame.writeByte(']');
+ case 0x04 -> frame.writeByte(',');
+ case 0x05 -> frame.writeByte('*');
+ default -> throw new IllegalArgumentException(
+ String.format("unexpected byte at %d: 0x%02x", buf.readerIndex() - 1, b2));
}
} else {
frame.writeByte(b1);