SatlMessage lints

This commit is contained in:
Milos Kozak 2023-08-28 22:49:01 +02:00
parent ed7a00dbc1
commit 4260ca7b11

View file

@ -105,10 +105,11 @@ public abstract class SatlMessage {
if (packetLength != packetLengthXOR) throw new InvalidPacketLengthsException(); if (packetLength != packetLengthXOR) throw new InvalidPacketLengthsException();
if (version != VERSION) throw new IncompatibleSatlVersionException(); if (version != VERSION) throw new IncompatibleSatlVersionException();
if (clazz == null) throw new InvalidSatlCommandException(); if (clazz == null) throw new InvalidSatlCommandException();
SatlMessage message = null; SatlMessage message;
try { try {
message = clazz.newInstance(); message = clazz.newInstance();
} catch (Exception ignored) { } catch (Exception exception) {
throw new IllegalArgumentException();
} }
message.parse(ByteBuf.from(payload)); message.parse(ByteBuf.from(payload));
message.setNonce(parsedNonce); message.setNonce(parsedNonce);
@ -135,10 +136,11 @@ public abstract class SatlMessage {
if (packetLength != packetLengthXOR) throw new InvalidPacketLengthsException(); if (packetLength != packetLengthXOR) throw new InvalidPacketLengthsException();
if (version != VERSION) throw new IncompatibleSatlVersionException(); if (version != VERSION) throw new IncompatibleSatlVersionException();
if (clazz == null) throw new InvalidSatlCommandException(); if (clazz == null) throw new InvalidSatlCommandException();
SatlMessage message = null; SatlMessage message;
try { try {
message = clazz.newInstance(); message = clazz.newInstance();
} catch (Exception ignored) { } catch (Exception exception) {
throw new IllegalArgumentException();
} }
message.parse(ByteBuf.from(payload)); message.parse(ByteBuf.from(payload));
message.setNonce(Nonce.fromProductionalBytes(nonce)); message.setNonce(Nonce.fromProductionalBytes(nonce));