From 41bef7c0b619c7bc925326451a56071b5736580a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 19 Jun 2013 08:36:16 +0000
Subject: [PATCH] Fix OPENDJ-986: Exception when reading messages from Replication server RS
---
opends/src/server/org/opends/server/replication/protocol/ReplServerStartDSMsg.java | 22 +++++-----------------
1 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/protocol/ReplServerStartDSMsg.java b/opends/src/server/org/opends/server/replication/protocol/ReplServerStartDSMsg.java
index 5c507ec..2018214 100644
--- a/opends/src/server/org/opends/server/replication/protocol/ReplServerStartDSMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/ReplServerStartDSMsg.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
package org.opends.server.replication.protocol;
@@ -74,7 +75,6 @@
* @param baseDn base DN for which the ReplServerStartDSMsg is created.
* @param windowSize The window size.
* @param serverState our ServerState for this baseDn.
- * @param protocolVersion The replication protocol version of the creator.
* @param generationId The generationId for this server.
* @param sslEncryption Whether to continue using SSL to encrypt messages
* after the start messages have been exchanged.
@@ -87,7 +87,6 @@
public ReplServerStartDSMsg(int serverId, String serverURL, String baseDn,
int windowSize,
ServerState serverState,
- short protocolVersion,
long generationId,
boolean sslEncryption,
byte groupId,
@@ -95,7 +94,7 @@
int weight,
int connectedDSNumber)
{
- super(protocolVersion, generationId);
+ super((short) -1 /* version set when sending */, generationId);
this.serverId = serverId;
this.serverURL = serverURL;
if (baseDn != null)
@@ -250,17 +249,7 @@
* {@inheritDoc}
*/
@Override
- public byte[] getBytes()
- throws UnsupportedEncodingException
- {
- return getBytes(ProtocolVersion.getCurrentVersion());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public byte[] getBytes(short protocolVersion)
+ public byte[] getBytes(short sessionProtocolVersion)
throws UnsupportedEncodingException
{
/* The ReplServerStartDSMsg is stored in the form :
@@ -268,7 +257,6 @@
* <degradedStatusThreshold><weight><connectedDSNumber>
* <serverState>
*/
-
byte[] byteDn = baseDn.getBytes("UTF-8");
byte[] byteServerId = String.valueOf(serverId).getBytes("UTF-8");
byte[] byteServerUrl = serverURL.getBytes("UTF-8");
@@ -290,8 +278,8 @@
byteServerState.length + 1;
/* encode the header in a byte[] large enough */
- byte resultByteArray[] =
- encodeHeader(MSG_TYPE_REPL_SERVER_START_DS, length, protocolVersion);
+ byte resultByteArray[] = encodeHeader(MSG_TYPE_REPL_SERVER_START_DS,
+ length, sessionProtocolVersion);
int pos = headerLength;
--
Gitblit v1.10.0