From 6dbbb6b61bfd5bb68ba1dda46cfa384853c03ff3 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sun, 26 Apr 2015 17:46:14 +0000 Subject: [PATCH] minor cleanup --- .../java/src/net/i2p/data/i2cp/MessagePayloadMessage.java | 2 +- core/java/src/net/i2p/data/i2cp/MessageStatusMessage.java | 2 +- .../src/net/i2p/data/i2cp/ReceiveMessageBeginMessage.java | 2 +- core/java/src/net/i2p/data/i2cp/SendMessageMessage.java | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/java/src/net/i2p/data/i2cp/MessagePayloadMessage.java b/core/java/src/net/i2p/data/i2cp/MessagePayloadMessage.java index 331ee3dad8..6d0c4daacc 100644 --- a/core/java/src/net/i2p/data/i2cp/MessagePayloadMessage.java +++ b/core/java/src/net/i2p/data/i2cp/MessagePayloadMessage.java @@ -96,7 +96,7 @@ public class MessagePayloadMessage extends I2CPMessageImpl { int size = 2 + 4 + 4 + _payload.getSize(); try { DataHelper.writeLong(out, 4, size); - DataHelper.writeLong(out, 1, getType()); + DataHelper.writeLong(out, 1, MESSAGE_TYPE); DataHelper.writeLong(out, 2, _sessionId); DataHelper.writeLong(out, 4, _messageId); DataHelper.writeLong(out, 4, _payload.getSize()); diff --git a/core/java/src/net/i2p/data/i2cp/MessageStatusMessage.java b/core/java/src/net/i2p/data/i2cp/MessageStatusMessage.java index d9122bd778..dd4f430541 100644 --- a/core/java/src/net/i2p/data/i2cp/MessageStatusMessage.java +++ b/core/java/src/net/i2p/data/i2cp/MessageStatusMessage.java @@ -308,7 +308,7 @@ public class MessageStatusMessage extends I2CPMessageImpl { try { DataHelper.writeLong(out, 4, len); - DataHelper.writeLong(out, 1, getType()); + DataHelper.writeLong(out, 1, MESSAGE_TYPE); DataHelper.writeLong(out, 2, _sessionId); DataHelper.writeLong(out, 4, _messageId); DataHelper.writeLong(out, 1, _status); diff --git a/core/java/src/net/i2p/data/i2cp/ReceiveMessageBeginMessage.java b/core/java/src/net/i2p/data/i2cp/ReceiveMessageBeginMessage.java index 032c1ea8be..cc685cbab2 100644 --- a/core/java/src/net/i2p/data/i2cp/ReceiveMessageBeginMessage.java +++ b/core/java/src/net/i2p/data/i2cp/ReceiveMessageBeginMessage.java @@ -76,7 +76,7 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl { try { DataHelper.writeLong(out, 4, len); - DataHelper.writeLong(out, 1, getType()); + DataHelper.writeLong(out, 1, MESSAGE_TYPE); DataHelper.writeLong(out, 2, _sessionId); DataHelper.writeLong(out, 4, _messageId); } catch (DataFormatException dfe) { diff --git a/core/java/src/net/i2p/data/i2cp/SendMessageMessage.java b/core/java/src/net/i2p/data/i2cp/SendMessageMessage.java index 67a67ffa47..37e5ea5f15 100644 --- a/core/java/src/net/i2p/data/i2cp/SendMessageMessage.java +++ b/core/java/src/net/i2p/data/i2cp/SendMessageMessage.java @@ -74,7 +74,7 @@ public class SendMessageMessage extends I2CPMessageImpl { @Override protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException { - if (true) throw new IllegalStateException("wtf, do not run me"); + throw new UnsupportedOperationException(); } /** @@ -84,8 +84,8 @@ public class SendMessageMessage extends I2CPMessageImpl { */ @Override public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException { - if (type != getType()) - throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType() + if (type != MESSAGE_TYPE) + throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + MESSAGE_TYPE + " class: " + getClass().getName() + ")"); if (length < 0) throw new IOException("Negative payload size"); @@ -129,7 +129,7 @@ public class SendMessageMessage extends I2CPMessageImpl { try { DataHelper.writeLong(out, 4, len); - DataHelper.writeLong(out, 1, getType()); + DataHelper.writeLong(out, 1, MESSAGE_TYPE); _sessionId.writeBytes(out); _destination.writeBytes(out); _payload.writeBytes(out); -- GitLab