From c015616756e6faa64060971753bc77978ae82dec Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 07 Oct 2009 12:19:42 +0000
Subject: [PATCH] The documentation and the configuration of a Replication Domain allow a maximum value of 65535 for the server-id property. Nevertheless, the server-id in the ReplicationDomain implementation is managed as a short allowing a maximum value of 32767.
---
opends/src/server/org/opends/server/replication/protocol/TopologyMsg.java | 41 ++++++++++++++---------------------------
1 files changed, 14 insertions(+), 27 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/protocol/TopologyMsg.java b/opends/src/server/org/opends/server/replication/protocol/TopologyMsg.java
index fd34473..f357409 100644
--- a/opends/src/server/org/opends/server/replication/protocol/TopologyMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/TopologyMsg.java
@@ -65,11 +65,6 @@
private List<RSInfo> rsList = new ArrayList<RSInfo>();
/**
- * The protocolVersion that should be used when serializing this message.
- */
- private final short protocolVersion;
-
- /**
* Creates a new changelogInfo message from its encoded form.
*
* @param in The byte array containing the encoded form of the message.
@@ -79,7 +74,6 @@
*/
public TopologyMsg(byte[] in, short version) throws DataFormatException
{
- protocolVersion = ProtocolVersion.getCurrentVersion();
decode(in, version);
}
@@ -88,22 +82,6 @@
*
* @param dsList The list of currently connected DS servers ID.
* @param rsList The list of currently connected RS servers ID.
- * @param version The protocol version to use to decode the msg.
- */
- public TopologyMsg(List<DSInfo> dsList, List<RSInfo> rsList, short version)
- {
- if (dsList != null) // null means no info, let empty list from init time
- this.dsList = dsList;
- if (rsList != null) // null means no info, let empty list from init time
- this.rsList = rsList;
- this.protocolVersion = version;
- }
-
- /**
- * Creates a new message from a list of the currently connected servers.
- *
- * @param dsList The list of currently connected DS servers ID.
- * @param rsList The list of currently connected RS servers ID.
*/
public TopologyMsg(List<DSInfo> dsList, List<RSInfo> rsList)
{
@@ -111,7 +89,6 @@
this.dsList = dsList;
if (rsList != null) // null means no info, let empty list from init time
this.rsList = rsList;
- this.protocolVersion = ProtocolVersion.getCurrentVersion();
}
// ============
@@ -125,6 +102,16 @@
public byte[] getBytes()
throws UnsupportedEncodingException
{
+ return getBytes(ProtocolVersion.getCurrentVersion());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public byte[] getBytes(short version)
+ throws UnsupportedEncodingException
+ {
try
{
/**
@@ -178,7 +165,7 @@
oStream.write(0);
}
- if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
+ if (version >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
{
Set<String> attrs = dsInfo.getEclIncludes();
oStream.write(attrs.size());
@@ -246,7 +233,7 @@
/* Read DS id */
int length = getNextLength(in, pos);
String serverIdString = new String(in, pos, length, "UTF-8");
- short dsId = Short.valueOf(serverIdString);
+ int dsId = Integer.valueOf(serverIdString);
pos +=
length + 1;
@@ -255,7 +242,7 @@
getNextLength(in, pos);
serverIdString =
new String(in, pos, length, "UTF-8");
- short rsId = Short.valueOf(serverIdString);
+ int rsId = Integer.valueOf(serverIdString);
pos +=
length + 1;
@@ -344,7 +331,7 @@
/* Read RS id */
int length = getNextLength(in, pos);
String serverIdString = new String(in, pos, length, "UTF-8");
- short id = Short.valueOf(serverIdString);
+ int id = Integer.valueOf(serverIdString);
pos +=
length + 1;
--
Gitblit v1.10.0