Github user d2r commented on a diff in the pull request:
https://github.com/apache/storm/pull/838#discussion_r45513302
--- Diff:
storm-core/src/jvm/backtype/storm/messaging/netty/SaslMessageToken.java ---
@@ -74,20 +84,32 @@ int encodeLength() {
*
* @throws Exception
*/
- ChannelBuffer buffer() throws Exception {
+ public ChannelBuffer buffer() throws IOException {
ChannelBufferOutputStream bout = new ChannelBufferOutputStream(
ChannelBuffers.directBuffer(encodeLength()));
- short identifier = -500;
int payload_len = 0;
if (token != null)
payload_len = token.length;
- bout.writeShort(identifier);
- bout.writeInt(payload_len);
+ bout.writeShort(IDENTIFIER);
+ bout.writeInt((int) payload_len);
+
if (payload_len > 0) {
bout.write(token);
}
bout.close();
return bout.buffer();
}
+
+ public static SaslMessageToken read(byte[] serial) {
+ ChannelBuffer sm_buffer = ChannelBuffers.copiedBuffer(serial);
+ short identifier = sm_buffer.readShort();
+ int payload_len = sm_buffer.readInt();
+ if(identifier != -500) {
--- End diff --
Can we use the new `IDENTIFIER` constant here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---